Android/Java - remove method reference from List

Viewed 217

I have a array list of method references (object::method) where I insert some methods when the user clicks a button. The problem is that I also need to remove some specific method references at some point.

If I use list.remove(object::method) the method is not removed because the lambda object::method has another ID every time I use it. I want each object::method to be removable so I need a way to get the same lambda ID for each object-method-pair.

Is there a way to accomplish this or do I have to manually keep track of every ID I added so I can remove it?

1 Answers
Related