Generic Declarations in Java
Let us see the declaration of java.util.List interface. In the above declaration, “E” is a placeholder for the type[…]
Read moreAmplify your java knowledge with javagyansite
Let us see the declaration of java.util.List interface. In the above declaration, “E” is a placeholder for the type[…]
Read more
The compiler only allows the List of Type Animal to the method add. Otherwise , it throws compilation error. Is[…]
Read more
Let us create the below Hierarchy of Classes. class Animal {} class Dog extends Animal{} class Cat extends Animal{} Here,[…]
Read more
Before we dwell into the concept of “Type Erasure”, let us have a look into the below code. Mixing Generic[…]
Read more
What are Java Generics? Generics in Java provide a way to create classes, interfaces, and methods that can work with[…]
Read more
equals method is used to check the equality of two objects based on it’s contents. equals versus == If two[…]
Read more
LinkedHashMap implements Map and extends HashMap.Please visit HashMap for understanding the internal working of HashMap before you read further so that it becomes[…]
Read more
Before we jump into TreeMap, let us first look into Tree Data Structure. The basic building block for the tree[…]
Read more
Comparable Comparator What is it? Here the Object compares itself with another Object of same type.For example: An Employee comparing[…]
Read more
CopyOnWriteArrayList(Introduced in JDK 1.5) SynchronizedList Creation List list = new CopyOnWriteArrayList(); List list = new ArrayList(); List syncList = Collections.synchronizedList(list);[…]
Read more