List
Related Tutorials
- ArrayList:
- LinkedList:
- HashSet
- LinkedHashSet:
- SortedSet
- TreeSet
- HashMap: HashMap is a part of java.util package in Java's collection. HashMap is used to store Key & Value pairs, it is denoted as HashMap<K, V>. Its does not guarantees to the order of the map elements i.e. unordered collection. It contains only unique elements i.e doesn’t allow duplicate keys. It is similar to the Hashtable class except that it is unsynchronized. it can have one null key but can have multiple null values. Click here to read in details.
- LinkedHashMap: It implements the Map interface and extends HashMap class. LinkedHashMap is just like HashMap with an additional feature of maintaining an insertion order of elements inserted into LinkedHashMap.It contains only unique elements. Click here to read in details.
- SortedMap: SortedMap is an interface in collection framework. Its extends Map interface.The main characteristic of a SortedMap is that, it orders the keys by their natural ordering, or by a specified comparator. Click here to read in details.
- TreeMap: TreeMap is the implementation of SortedMap interface. it orders the keys by their natural ordering, or by a specified comparator. Click here to read in details.
Q- What is the difference between collection and collections in java?
Collection is an interface,it is the root interface of collection hierarchy.
Collections is class present in java.util.package to define several method for collection object. Collections class has static methods that method returns the collection.
Q- What is the default size & load factor of Collection: ArrayList, Vector, HashSet, Hashtable, and HashMap.
Collection | Java 8 | Before Java 8 | ||
Initial capacity | Load factor | Initial capacity | Load factor | |
ArrayList
|
0 (lazily initialized to 10)
|
10
|
||
Vector
|
10
|
10
|
||
HashSet
|
16
|
0.75
|
16
|
0.75
|
HashMap
|
16
|
0.75
|
16
|
0.75
|
Hashtable
|
16
|
0.75
|
11
|
0.75
|
Related Tutorials
- Java Collections Interview
- List Interface In Java
- ArrayList
- LinkedList
- Custom Own ArrayList Implementation
- Custom LinkedList implementation in java
- Set Interface In Java
- Map Interface In Java
- HashMap
- TreeMap
- HashMap Vs ConcurrentHashMap
- HashMap Vs HashTable In Java
- HashMap Vs HashSet In Java
- HashMap Vs TreeMap In Java
- HashMap vs LinkedHashMap In Java
- TreeSet Vs TreeMap In Java
- SortedSet Vs TreeSet In Java
- SortedMap Vs TreeMap In Java
- Array Vs ArrayList In Java
- ArrayList Vs LinkedList In Java
- How HashSet Works Internally
- How TreeMap Works Internally
- How HashMap Works Internally
- How ConcurrentHashMap Works Internally
- How To Detect Loop In A LinkedList In Java
- Detect And Remove Loop In A LinkedList
No comments:
Post a Comment