java - How to remove an object from a list -


in java, can remove object list using method list.remove(object o), method uses equals method of object identify element in list. but, requires override equals method(otherwise default implementation of equals method used, involves comparing references). if dealing list of objects , developer doesn't have liberty change source code of object implement equals method, can do? wondering why java has not provided method list.remove(object o, comparator c), because remove object based on custom equality condition(implemented comparator), solutions problem?

if want more complicated, can iterate yourself, performing comparisons want, , use list.remove(int) remove index.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -