What is List interface

What is List interface

What is List interface Answer: public interface List extends Collection List is ordered Collection (also called sequence). Lists can contain duplicate elements. Because it extends Collection all operations is inherited from it, List interface includes following below operations:

Convert ArrayList to Arrays

Convert ArrayList to Arrays

Convert ArrayList to Arrays Answer: Many time in programming situation arises to convert ArrayList to Arrays and java API provides many ways to convert from ArrayList to Arrays. Please have java example below where I will show three different ways … Continue reading

Difference ArrayList Vector

Difference ArrayList Vector

Difference ArrayList Vector Answer: Below are differences: ArrayList Vector ArrayList is not synchronized (Not thread safe) Vector is synchronized (Thread safe) ArrayList does not contains legacy methods Vector class contains several legacy methods those are not part of Collections Data … Continue reading

What is TreeMap

What is TreeMap

What is TreeMap Answer: public class TreeMap<K,V> extends AbstractMap<K,V> implements NavigableMap<K,V>, Cloneable, Serializable In java TreeMap class is an example of SortedMap where the order of the keys could be sorted and by default when we store data its keys … Continue reading