ArrayList trimToSize() method in java

Let’s learn ArrayList trimToSize() method in java. ArrayList trimToSize() method in java trimToSize() method trims the capacity of given ArrayList instance to be the list’s current size. Now let’s see an example on ArrayList trimToSize() method. import java.util.ArrayList; public class TrimToSizeMethodJavaExample { public static void main(String[] args) { // initially size of ArrayList is 10…

Read More ArrayList trimToSize() method in java