I have an arrayList with an custom object:
public ArrayList<Mode> modes = new ArrayList<>();
That list has for example 3 instances in it. How would I set all those instances to be available for the garbage collector to remove them?
for (Mode mode : modes)
mode = null;
The above does not work. My Eclipse (IDE) just says that the local variable mode is never used. How would I get the actual instance to remove it?