View RSS Feed

My Java Tips

  1. Using Vectors

    by , 11-08-2011 at 07:26 PM (My Java Tips)
    When using arrays, you have to give their size at declaration. So arrays do not expand dynamically. Vectors expand automatically when data is added to them. Vector class is included in java.util package. Vectors are used to store Objects.

    Vector is thread safe. It means Vectors are synchronized, means you can use Vectors even if your object might be shared by two or more threads at a same time. This makes Vector slower than ArrayList which is not thread safe.

    Following ...