How do I check to see if two Lists are the same?
import greenfoot.*;
import java.util.*;
public class PackingList extends Actor
{
private static List<Items> packingList;
private int top;
private int bottom;
private int accessory;
private String packingListOutput = "";
public PackingList()
{
packingList = new ArrayList<Items>();
setPackingList();
}
public static List<Items> getPackingList()
{
return packingList;
}
public String setPackingList()
{
Random rand = new Random();
this.top = rand.nextInt(3);
this.bottom = rand.nextInt(2);
this.accessory = rand.nextInt(3);
if(this.top == 0)
{
this.packingListOutput += "t-shirt, ";
packingList.add(new TShirt());
}
else if(this.top == 1)
{
this.packingListOutput += "tank, ";
packingList.add(new Tank());
}
else
{
this.packingListOutput += "";
}
if(this.bottom == 0)
{
this.packingListOutput += "skirt, ";
packingList.add(new Skirt());
}
else
{
this.packingListOutput += "shorts, ";
packingList.add(new Shorts());
}
if(this.accessory == 0)
{
this.packingListOutput += "sunglasses, ";
packingList.add(new Sunglasses());
}
else if(this.accessory == 1)
{
this.packingListOutput += "necklace, ";
packingList.add(new Necklace());
}
else
{
this.packingListOutput += "";
}
return this.packingListOutput;
}
}private List<Items> guess;
public void checkPackingList()
{
guess = getIntersectingObjects(Items.class);
//figure out how to see if the list are equal
PackingList.getPackingList();
}