What is Difference Between Iterator and Enumeration

Both Iterator and Enumeration are used to traverse Collection objects, in a sequential fashion. Enumeration can be applied to Vector and HashTable. Iterator can be used with most of the Collection objects. The main difference between the two is that Iterator is fail-safe. i.e,  If you are using an iterator to go through a collection … Read more

What is Enumeration in Java

An enumeration is an object that generates elements one at a time, used for passing through a collection, usually of unknown size. The traversing of elements can only be done once per creation. In Java, the term “Enumeration” usually refers to the legacy interface java.util.Enumeration. This interface was part of the original Java Collections Framework and … Read more

Difference Between Vector and ArrayList

Vector & ArrayList both classes are implemented using dynamically resizable arrays, providing fast random access and fast traversal. ArrayList and Vector class both implement the List interface. Synchronization – ArrayList is not thread-safe whereas Vector is thread-safe. In Vector class each method like add(), get(int i) is surrounded with a synchronized block and thus making Vector … Read more

What is ArrayList In Java

ArrayList is a part of the Collection Framework. We can store any type of objects, and we can deal with only objects. It is growable In Java, an ArrayList is a part of the Java Collections Framework and is implemented in the java.util package. It is a dynamic array that can grow or shrink in … Read more

What is a Vector in Java

Vector implements a dynamic array. It is similar to ArrayList, but with two differences:  Vector is synchronized, and it contains many legacy methods that are not part of the collections framework. In Core Java, a “vector” typically refers to the Vector class, which is a part of the Java Collections Framework. The Vector class implements a dynamic array that … Read more