+ 1
what is the difference between size() and capacity() from vector class
2 Réponses
+ 1
size is the number of elements which is currently hold. capacity is the number of element which can maximum hold.
0
The difference between capacity() and size() in java.util.Vector is that the size() is the number of elements which is currently hold and capacity() is the number of element which can maximum hold. A Vector is a dynamically growable data structure, and it would reallocate its backing array as necessary. Thus, there is no final capacity, but you can set what its initial value is. A Vector defaults to doubling the size of its array. More....
http://net-informations.com/java/cjava/size.htm