multithreading - Java's Queue cannot specify limited size, so what's difference between "add" and "offer" -
multithreading - Java's Queue cannot specify limited size, so what's difference between "add" and "offer" -
java's queue:the difference between "add" , "offer" if queue has been full, "add" cause exception, , "offer" homecoming false.
but question is "when queue can full"? seems there no size-fixed queue in standard java, , queue has no method specify size. if go on add/offer element queue, queue extended automatically.
if true, what's difference between "add" , "offer" when utilize it. if not true, how specify max size of queue.
the interface allows implementations limited size. not require implementations have size bound forcing implementations have setsize
method.
see instance arrayblockingqueue(int capacity)
.
so if go on add/offer element queue, queue extended automatically.
no, queue
implementation not required grow automatically.
java multithreading java-ee linked-list queue
Comments
Post a Comment