반응형

출처: https://docs.oracle.com/javase/7/docs/api/java/util/Queue.html

 

Queue (Java Platform SE 7 )

A collection designed for holding elements prior to processing. Besides basic Collection operations, queues provide additional insertion, extraction, and inspection operations. Each of these methods exists in two forms: one throws an exception if the opera

docs.oracle.com

자바에서 큐 인터페이스를 쓰려는데, 비슷한 역할을 하는 메소드가 2개나 있어서 뭐가 다른가 하고 찾아보았다.

API 문서를 보니까, 예외를 던지는 녀석들과 특정값을 던지는 녀석들로 나뉘어져있다고 한다.

 

  Throws exception Returns special value
Insert add(e) offer(e)
Remove remove() poll()
Examine element() peek()
반응형
Posted by 애콜라이트
l

free counters