In an exercise I am asked to obtain the size and capacity of a previously filled Vector and ArrayList.
In the case of the vector there are not many problems to do it, because it has a method.
Vector<Object> planetas = new Vector<>();
planetas.add("Jupiter");
planetas.add("Marte");
planetas.add("Mercurio");
planetas.add("Neptuno");
planetas.add("Pluton");
planetas.add("Saturno");
planetas.add("Tierra");
planetas.add("Urano");
planetas.add("Venus");
System.out.println(planetas.size());
System.out.println(planetas.capacity());
But my problem is with the ArrayList, that if I have the .size () method but there is nothing similar to the .capacity () of the Vector.
Can you tell me if there is a method or some way to obtain the capacity?