I have an ArrayList as an Object(from reflection) and made my own class that extends off of it(ArrayListMonitor) that calls a function every time an arraylist has an item removed/added. But then I get this: java.util.ArrayList cannot be cast to ArrayListMonitor
I need to monitor the arraylist as I am loading a jar and creating a server from it, that has a clients field I need to monitor.
I have an ArrayList as an Object(from reflection) and made my own class that
Share
If the
ArrayListis not of instanceArrayListMonitorthis cannot work:If you want to monitor the array list you have several options:
new ArrayListMonitor(a);and create delegates for all relevant methods in theArrayList