Differentiate between array list and vector in java.

devquora
devquora

Posted On: Jun 25, 2024

 

Following are some of the differences between array list and vectors in JAVA: –

  • An array list is not synchronized, whereas a vector is synchronized.
  • An array list works fast, whereas a vector does not.
  • There is an increase of 50% in the array size whenever any element is inserted inside the array list, whereas vector defaults to doubling the size of its array.
  • The increment size is not defined in an array list, whereas in vector it is defined.
  • Only iterators can be used in an array list for traversing an array, whereas vectors can use both enumeration and iterators for traversing an array.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Core Java Interview Questions

    Explain the significance of class loaders in Bootstrap?

    Classloaders in Java load classes into the virtual environment, converting named classes into binary form. They load essential classes, such as java.lang.Object, on demand. Java Runtime Environment in..

    Core Java Interview Questions

    What is the difference between JDK, JRE, and JVM?

    JVM (Java Virtual Machine) executes Java bytecode, providing a runtime environment. JRE (Java Runtime Environment) includes JVM and necessary libraries. JDK (Java Development Kit) contains JRE and dev..

    Core Java Interview Questions

    What are the various access specifiers in Java?

    Access specifiers in Java determine the access scope of classes, methods, and fields. They include public (accessible from anywhere), protected (accessible within the same package and subclasses), def..