A basic LinkedList Implementation in java(J2ME compatible)
Posted: Tue Aug 24, 2010 6:22 pm
I wanted a LinkedList implementation in J2ME for my on going work on a MSN client. J2ME does not have a built in LinkedList implementation. So I wrote this. Not very advance though.
I am sharing this because I could not find a good implementation via google. I hope that this will be of some use to some one. At least to a beginner.
Usage Example;
(This implementation support storing String type LinkedList, but you can change it)
I haven't fully tested this implementation. I did not check removeLast at all.
Suggestions are welcome!

I am sharing this because I could not find a good implementation via google. I hope that this will be of some use to some one. At least to a beginner.

Usage Example;
(This implementation support storing String type LinkedList, but you can change it)
Code: Select all
LinkedList linkedList=new LinkedList();
linkedList.insertFirst("How ");
linkedList.insertFirst("Hello,");
linkedList.insertLast("are ");
linkedList.insertLast("you?");
//reading the linked list;
LLNode temp=linkedList.removeFirst();/*reading this way destroys your linked list*/
/*But I want this behaviour of a queue in my app*/
while(temp!=null){
System.out.println(temp.data);
temp=li.removeFirst();
}

Suggestions are welcome!