Saturday, 16 August 2014

How to add List to another List

How to reverse a string in java

package test;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

public class MainS {


/* we have two lists as l and b and will add and reterieve list l to b */
public static void main(String[] args) {
List l= new ArrayList();
l.add("1");
l.add("2");
List b= new ArrayList ();
b.addAll(l);

ListIterator lt= b.listIterator();
while(lt.hasNext())
{
System.out.println(lt.next());
}


}


}


See :

Android Hello World
 How Objects are stored in heap and Stack in java
Internal Working Of ArrayList
How to sort an Array List
5 main differences between HashTable and HashMap
Overriding/method Overriding In java

No comments:

Post a Comment