Click here to watch in Youtube : https://www.youtube.com/watch?v=pnVMOYlXYFs
ArrayListExample.java
Output
ArrayListExample.java
import java.util.ArrayList; import java.util.HashSet; /* * Example of ArrayList(Collection<? extends E> c) Constructor. */ public class ArrayListExample { public static void main( String[] args ) { HashSet<String> hashSet = new HashSet<String>(); hashSet.add("Ram"); hashSet.add("Dave"); hashSet.add("Rohit"); System.out.println("hashSet : " + hashSet); /* * Constructs a list containing the elements of the specified * collection, in the order they are returned by the collection's * iterator. */ ArrayList<String> arrayList = new ArrayList<String>(hashSet); System.out.println("arrayList : " + arrayList); } }
hashSet : [Rohit, Dave, Ram] arrayList : [Rohit, Dave, Ram]
To Download ArrayListDemoParamCons Project Click the below link
https://sites.google.com/site/javaee4321/java-collections/ArrayListDemoParamCons.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment