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

What is the Difference Between a HashMap and a Hashtable in Java

Hashtableis synchronized, whereas HashMap is not. This makes HashMap better for non-threaded applications, as unsynchronized Objects typically perform better than synchronized ones. Hashtabledoes not allow null keys or values. HashMap allows one null key and any number of null values. One of HashMap’s subclasses is LinkedHashMap, so in the event that you’d want predictable iteration order (which is insertion order by default), you could … Read more