Results 1 to 4 of 4
  1. #1
    ajeeb is offline Member
    Join Date
    Dec 2008
    Posts
    30
    Rep Power
    0

    Default Methods of the java.util.Vector

    Hi,
    Learnt that Vector class is synchronized. But looking at the javadoc for java.util.Vector I can't see the synchronized keyword mentioned in any of its method signature. Why ?

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  3. #3
    ajeeb is offline Member
    Join Date
    Dec 2008
    Posts
    30
    Rep Power
    0

    Default

    Then what do we mean when we say the Vector class is synchronized ?

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    I hope you know what's meaning on synchronized, right?

    Vector class basically implements an array of objects. But the size can grow or shrink accordingly.

    More details from the Java doc.

    Each vector tries to optimize storage management by maintaining a capacity and a capacityIncrement. The capacity is always at least as large as the vector size; it is usually larger because as components are added to the vector, the vector's storage increases in chunks the size of capacityIncrement. An application can increase the capacity of a vector before inserting a large number of components; this reduces the amount of incremental reallocation.
    If you have read carefully, you can find the solution form there.

Similar Threads

  1. java.util.zip Question
    By acp26b in forum New To Java
    Replies: 3
    Last Post: 08-07-2008, 05:12 AM
  2. java.util
    By Java Tutorial in forum Java Tutorial
    Replies: 1
    Last Post: 02-07-2008, 01:46 PM
  3. Using java.util.Formatter
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-16-2007, 02:29 PM
  4. how to use java.util.Properties?
    By christina in forum New To Java
    Replies: 2
    Last Post: 08-03-2007, 05:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •