A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Write a program for Vector in collection framework

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
import java.util.Vector;

public class VectorDemo {
   public static void main(String[] args)
   {
       Set set=new HashSet(Arrays.asList( "H", "E", "E", "R", "A" )); 
       String[] so=new String[set.size()];
       so=(String[])set.toArray(so);
       for (int i = 0; i < so.length; i++)
       {
           System.out.println(so[i]);
       }
       System.out.println(set);
   }   
}


output:





LEARN TUTORIALS

.

.