indexOf returns 2
Things are getting a little complicated. It would be good to look at some details.
ArrayList of entries is constructedEntry objects are put into the list.Entry object is created.indexOf() searches for the target in the list.
equals(Object) method of Entry is used.
The indexOf(Object) method is a member of the ArrayList,
but it uses the equals(Object) method of Entry.
Would playing with the program help?