LinkedList Method | Sololearn: Learn to code for FREE!

+5

LinkedList Method

I would like to know the difference between .add() method and the .offer() method. Thanks!!

5/3/2018 3:37:23 AM

Antopixel㊙️

1 Answer

New Answer

+9

Although they are very similar they aren't the same. There is a difference in the interfaces that are used within the methods, but the most substantial difference to you would be that if the add method can not add the item to the list an error will be thrown, whereas the offer method would not. The non-positional add method and the addLast method are however, the same.