I was looking at source code of JDK8's HashMap Implementation. I noticed Hashmap is uses a array of Nodes.
transient Node<K,V>[] table;
There is a Node Class defined inside the HashMap Class. Node Class is declared as a static class. Below is the code for Node Class
static class Node<K,V> implements Map.Entry<K,V> {
final int hash;
final K key;
V value;
Node<K,V> next;
Node(int hash, K key, V value, Node<K,V> next) {
this.hash = hash;
this.key = key;
this.value = value;
this.next = next;
}
/*
Some other methods
.
.
.
.
.
*/
}
I would like to know if the class has static keyword, how are we able to create object of this static class ? What is the significance of creating a static class if we are creating objects for this class.( Static is something that is not associated with instances )
Why has this class been created as Static Nested Class as compared to inner class(non-static nested class) if we wanted to create objects of this class.