equals and hasCode override for indexOf test in arrayList