I create an arraylist full of "states" but can't find states in the list after they have been added
public class State {
int a;
int b;
int c;
public State(int a,int b,int c) {
super();
this.a = a;
this.b = b;
this.c = c;
}
}
Then in the main class
public class Main {
static ArrayList<State> nodes = new ArrayList<State>();
public static void main(String[] args) {
State randomState = new State(12,0,0);
nodes.add(randomState);
System.out.println(nodes.contains(new State(12,0,0)));
}
}
This would return false but if i do
System.out.println(nodes.contains(randomState));
would return true. Any help is appreciated