It doesn’t decrease this automatically. From the doc.
public void trimToSize()
Trims the capacity of this ArrayList instance to be the list’s current size. An application can use this operation to minimize the storage of an ArrayList instance.
More Related Contents:
- When to use LinkedList over ArrayList in Java?
- Initialization of an ArrayList in one line
- How do I remove repeated elements from ArrayList?
- Sorting an ArrayList of objects using a custom sorting order
- Converting ‘ArrayList to ‘String[]’ in Java
- How to sort a List/ArrayList?
- How to count the number of occurrences of an element in a List
- How to find an object in an ArrayList by property
- How to sort an ArrayList in Java [duplicate]
- Which Java Collection should I use?
- How to randomize two ArrayLists in the same fashion?
- How do I make my ArrayList Thread-Safe? Another approach to problem in Java?
- How to sort an ArrayList using multiple sorting criteria?
- Best way to create a hashmap of arraylist
- Add multiple items to an already initialized arraylist in Java
- How to remove element from ArrayList by checking its value?
- Empty an ArrayList or just create a new one and let the old one be garbage collected? [duplicate]
- ArrayList filter [duplicate]
- ArrayList Vs LinkedList
- ArrayList: how does the size increase?
- What is the Simplest Way to Reverse an ArrayList?
- ArrayList vs LinkedList from memory allocation perspective
- Vector vs Collections.synchronizedList(ArrayList)
- How to remove common values from two array lists
- How to sort Arraylist of objects
- How can I generate a list or array of sequential integers in Java?
- What is a WeakHashMap and when to use it? [duplicate]
- best way to pick a random subset from a collection?
- Is it possible in java make something like Comparator but for implementing custom equals() and hashCode()
- Classical set operations for java.util.Collection