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

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -