• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt in vector  RSS feed

 
arulraj michaelraj
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. What is the difference between capacity and size in vector?

2. why the vector class has methods capacity() and size() separately & what is the use of them?


Please reply me...


Thanks
Arulraj
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you had a look at the JavaDocs?
 
bart zagers
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are aware that Vector is an "old" class that normally should not be used anymore in new code?
In most cases, when you need a vector-style class, a List (ArrayList) is a better option. An obvious exception is of course when you have old code that still uses a Vector.

Bart.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!