import java.awt.List;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

import javax.swing.text.html.HTMLDocument.Iterator;


public class bucky {


public static void main(String []args)
{

String [] names = {"eggs","lasrers","hats","pie"};
   List<String> list1 = new ArrayList<String>(); 

//add items to array
for(String x:names)
{
list1.add(x);

}
String [] morenames = {"doll","barbie","hotwheels"};
List<String> list2 = new ArrayList<>();

//add items 
for(String y:morenames)
{
list2.add(y);
}

for(int i =0; i< list1.size();i++)
{
System.out.println("list is =  "+list1.get(i));
}
for(int i = 0;i< list2.size();i++)
{
System.out.println("elements of list are " +list2.get(i));
}

PLS SOME ONE HELP ..I AM GETTING THE ERROR SHOWN BELOW ON WRITING THIS CODE

The type List is not generic; it cannot be parameterized with arguments <String>