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 moreThe compiler only allows the List of Type Animal to the method add. Otherwise , it throws compilation error. Is[…]
Read moreLet us create the below Hierarchy of Classes. class Animal {} class Dog extends Animal{} class Cat extends Animal{} Here,[…]
Read moreBefore we dwell into the concept of “Type Erasure”, let us have a look into the below code. Mixing Generic[…]
Read moreWhat are Java Generics? Generics in Java provide a way to create classes, interfaces, and methods that can work with[…]
Read moreequals method is used to check the equality of two objects based on it’s contents. equals versus == If two[…]
Read moreLinkedHashMap implements Map and extends HashMap.Please visit HashMap for understanding the internal working of HashMap before you read further so that it becomes[…]
Read moreBefore we jump into TreeMap, let us first look into Tree Data Structure. The basic building block for the tree[…]
Read moreComparable Comparator What is it? Here the Object compares itself with another Object of same type.For example: An Employee comparing[…]
Read moreCopyOnWriteArrayList(Introduced in JDK 1.5) SynchronizedList Creation List list = new CopyOnWriteArrayList(); List list = new ArrayList(); List syncList = Collections.synchronizedList(list);[…]
Read more