Skip to content
Advertisement

How to set arrayList size as null?

JavaScript

Why the size of the arrayList choice is 5 when all the elements have been set to null

Advertisement

Answer

Because the ArrayList still contains 5 Objects. They are null, but they are objects, thus present in the list!

You can empty the ArrayList, by calling choice.clear();

Advertisement