Let's say I have a class
public class Data{ public int k; public int l; public Data(int k, int l){ this.k = k; this.l = l; } public boolean equals(Date m){ if(this.k == mk && this.l = ml) return true; return false; } }
And I add some Data objects to the ArrayList:
ArrayList<Data> holder = new ArrayList<Data>; Data one = new Data(0,0); Data two = new Data(0,4); Data three = new Data(0,5);
Why doesn't indexOf find this ?:
holder.indexOf(new Data(0,4));
Is indexOf better than the list of array itself? Or am I missing something.
java arraylist
p1001
source share