0
Java Queue
If Queue is implemented by Linked List, what is the return type of offer() method ? Or void ?
2 ответов
0
The latter form of the insert operation is designed specifically for use with capacity-restricted Queue implementations; in most implementations, insert operations cannot fail. For example when Queue is implemented by array, size > capacity, return false.
0
You can easily look this up in the java docs.
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Queue.html#offer(E)
offer() returns a boolean that is true if the element was added successfully.