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

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -