I am having problems with comparing elements of an Integer ArrayList (single dimension) with certain values. Is there anyone who sees what I'm doing wrong?
Here I declare the new lists:
Here I add numbers to them:
Here I check (very inefficiently probably) if there are 3 of the same items in the list:
And here I check for a diagonal win, so that would mean I have a same x and y, with 3 different values. In the contains method it goes wrong at the line "int placeholder = x.get(i);" I get the error "incompatible types: jave.lang.Object cannot be converted to in".
Every bit of help is welcome, as I searched the web for over an hour for a solution already but I can't find it.

private List listx1 = new ArrayList<Integer>(); private List listy1 = new ArrayList<Integer>(); private List listx2 = new ArrayList<Integer>(); private List listy2 = new ArrayList<Integer>();

else if(Greenfoot.isKeyDown("enter") && canPlace() && !menuTime) { int e = getX(); int f = getY(); if(player==1) { getWorld().addObject(new cross(),e,f); setImage("naught-small.png"); listx1.add(e); listy1.add(f); if(doesWin(listx1) || doesWin(listy1) || diagonalWin(listx1, listy1)) System.out.print("Hooray! Crosses wins!\n"); wait(20); player = 2; } else { getWorld().addObject(new naught(),e,f); setImage("cross-small.png"); listx2.add(e); listy2.add(f); if(doesWin(listx2) || doesWin(listy2) || diagonalWin(listx2, listy2)) System.out.print("Hooray! Naughts wins!\n"); wait(20); player = 1; } }

public boolean doesWin(List x) { Collections.sort(x); if(Collections.frequency(x, 100) == 3 || Collections.frequency(x, 300) ==3 || Collections.frequency(x, 500) == 3) return true; else return false; }

public boolean diagonalWin(List x, List y) { if(contains(x, 100) && contains(y,100)) return true; return false; } public boolean contains(List x, int z) { for(int i=0; i<x.size(); i++) { int placeholder = x.get(i); } return false; }