Saturday, April 30, 2016

Java Array, Vector, LinkedList and so on






Java type of lists

ArrayList al = new ArrayList();
al.add(3);
al.add(2);
al.add(1);
al.add(4);
al.add(5);
al.add(6);
al.add(6);

Iterator iter1 = al.iterator();
while(iter1.hasNext()){
System.out.println(iter1.next());
}
 
Integer a[] = {1,2,3,4,5,6,7,8,9,10};
ArrayList X = new ArrayList(Arrays.asList(a));
ArrayList A = new ArrayList(Arrays.asList(1,2,3,4,5,6,7,8,9,10));
Vector B= new Vector(Arrays.asList(1,2,3,4,5,7,8,9,10)); 

https://dzone.com/articles/arraylist-vs-linkedlist-vs

No comments:

Blog Archive