I was checking Java.util.LinkedList
class and found that Linked List class offers several methods
public void addFirst(E e)
public boolean offerFirst(E e)
public void push(E e)
All these 3 methods add an element to the head of the list. So why does different implementation require for the same function?
Is it because push is meant for Stack and
offerFirst – Dequeue
addFirst – LinkedList
or some other fundamentals?
Please share some insight here. Thanks