LinkedList
- The underlying data structure for LinkedList is double LinkedList.
- Insertion order is preserve.
- Duplicate objects are allowed.
- Heterogeneous objects are allowed.
- Null insertion is possible.
- Implements Serializable & Cloneable interface but not Random Access.
- LinkedList is not suitable if our frequent operation is not retrieval operation.
Constructors:-
- LinkedList l = new LinkedList ();
creates an empty LinkedList objects.
- LinkedList l = new LinkedList ( collection c )
In general, LinkedList an be used for implementing Stacks and Queue. To support this requirement LinkedList class define the following specific method.
- void add First ( object o )
- void add Last ( object o )
- void remove First ( )
- void remove Last( )
- void get First ( ) ;
- void get Last ( );
import java. until. * ; Class Exam LinkedList { public static void main(string[] args) { LinkedList l = new LinkedList (); l. add ( "narayana" ); l. add (30); l. add (null); l. set ( o, "s/w" ) ; l. add ( o, anitha" ); l. remove Last (); l. add First ( "ccc" ); System.out.println (l); } }
Hello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in the IT industry for more than 12 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting, Website Development, and IAM(ForgeRock) Specialist
I am a self-learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.