How to get order of collection when collection was first created

Hi

I have changed the sort order of a linked list by method of sort using comparator.Now i want to get back the sort order when the list first created.How i cant get that.The programe is as below

import java.util.*;

public class AlgorithmDemo{

public static void main(String args[]){

LinkedList <Integer> ll=new LinkedList <Integer> ();

ll.add(new Integer(-8));

ll.add(new Integer(20));

ll.add(new Integer(-20));

ll.add(new Integer(8));

System.out.println("Original order....");

System.out.println(ll);

System.out.println("Order after sorting....");

Collections.sort(ll);

System.out.println(ll);

System.out.println("Reverse sorting order....");

Comparator cm=Collections.reverseOrder();

Collections.sort(ll,cm);

System.out.println(ll);

System.out.println("After shufling....");

Collections.shuffle(ll);

System.out.println(ll);

}

}

[987 byte] By [Saswataa] at [2007-11-26 18:24:47]
# 1
Short answer, you cannot.You may consider cloning your list some way and sorting the clone, not the original. Then you still have the original order in the original list.
OleVVa at 2007-7-9 5:58:51 > top of Java-index,Core,Core APIs...