Hi
we want to create a link list like as c language in java
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Mar 5, 2012, 12:50 AM
The LinkedList class extends AbstractSequentialList and implements the List interface. It provides a linked-list data structure. It has the two constructors, shown here:
LinkedList( )
LinkedList(Collection c)
The first constructor builds an empty linked list. The second constructor builds a linked list that is initialized with the elements of the collection c.
In addition to the methods that it inherits, the LinkedList class defines some useful methods of its own for manipulating and accessing lists. To add elements to the start of the list, use addFirst( ); to add elements to the end, use addLast( ). Their signatures are shown here:
void addFirst(Object obj)
void addLast(Object obj)
Here, obj is the item being added.
To obtain the first element, call getFirst( ). To retrieve the last element, call getLast( ). Their signatures are shown here:
Object getFirst( )
Object getLast( )
To remove the first element, use removeFirst( ); to remove the last element, call removeLast( ). They are shown here:
Object removeFirst( )
Object removeLast( )
Refer
http://www.java-samples.com/showtutorial.php?tutorialid=347
http://www.mycstutorials.com/articles/data_structures/linkedlists
Thanks