bhavin
08/08/2019, 9:01 AMvar getVideoList: ArrayList<Any> look at this my code https://paste.ofcode.org/PpCQuDjkAvtKpv7U29k7cDdiesieben07
08/08/2019, 9:03 AMActionHelp does not implement equals and hashCode, which means contains and friends will use object identity. You should either implement equals and hashCode or make it a data class, which will generate those for you based on the component values.bhavin
08/08/2019, 9:11 AMequalsgildor
08/08/2019, 9:12 AMgildor
08/08/2019, 9:13 AMdiesieben07
08/08/2019, 9:14 AMbhavin
08/08/2019, 9:19 AMvar getVideoList: ArrayList<ActionHelp> but instead I'm using (i need to use ) var getVideoList: ArrayList<Any> so I can't compare this list with ActionHelp class's data.diesieben07
08/08/2019, 9:21 AMArrayList<ActionHelp> and ArrayList<Any> will behave exactly the same in regards to equality of their items.
To me it sounds like you want a Map<ID, ActionHelp>bhavin
08/08/2019, 9:22 AMbhavin
08/08/2019, 10:47 AMMap<ID, ActionHelp> but I did Like this which is working right now
ActionHelp Class : https://paste.ofcode.org/H8rg7Ly9vrTMVU4JXujcAc
Small code snippet : https://paste.ofcode.org/BUB9ij6YzWMmJ5aB4kZQ7F
please check It and suggest me better way 🙂diesieben07
08/08/2019, 11:03 AMequals method will not do anything useful. It classifies everything that is not the same object as "equal". Moreover, if you override equals you must override hashCode in coordination, the two methods always go together.bhavin
08/08/2019, 11:13 AMdiesieben07
08/08/2019, 11:14 AMequals and hashCode accordingly (so that the same item is regarded as equal) or you can use a Map if you don't want to do that.bhavin
08/08/2019, 11:17 AMdiesieben07
08/08/2019, 11:18 AMequals needs to return true if you want the two objects (this and the parameter) to be equal.bhavin
08/08/2019, 11:23 AMdiesieben07
08/08/2019, 11:24 AMdata classbhavin
08/08/2019, 11:27 AMList < Student > studentsLst = new ArrayList < Student > (); I m use like this List < Any > studentsLst = new ArrayList < Any > (); so problem is when I try to do studentsLst.contain is not workingdiesieben07
08/08/2019, 11:28 AMList<Any> or List<Student>diesieben07
08/08/2019, 11:29 AMequals and hashCode are virtual (non-static) methods, they will be dispatched at runtime.bhavin
08/08/2019, 11:58 AM