java_arraylist.trimtosize

Java ArrayList.trimToSize()

Java ArrayList.trimToSize() is a method in the Java ArrayList class that reduces the capacity of the list to the current size. It helps free up unused memory when the list has grown and then shrunk, as it adjusts the internal array to the exact size needed. Introduced in Java 1995 with Java 1.2, trimToSize() is useful for optimizing memory usage when it is known that the list will not grow further.

https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html

java_arraylist.trimtosize.txt · Last modified: 2025/02/01 06:49 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki