From charlesreid1

(Created page with "Maps are implemented in Java as part of the Collections framework Here is a link to the OpenJDK source code, util module: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76...")
 
No edit summary
Line 1: Line 1:
Maps are implemented in Java as part of the Collections framework
=Notes=
 
Maps are implemented in Java as part of the Collections framework. These are notes from the source.


Here is a link to the OpenJDK source code, util module: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/
Here is a link to the OpenJDK source code, util module: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/


The Java Collections framework provides a number of different useful map-related classes.
The Java Collections framework provides a number of different useful map-related classes.
==AbstractMap==


The top level class is an abstract class called AbstractMap.java: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/AbstractMap.java
The top level class is an abstract class called AbstractMap.java: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/AbstractMap.java
==Map==


Next is the base map class Map.java: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/Map.java
Next is the base map class Map.java: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/Map.java
==HashMap==


HashMap is a faster, O(1) map that uses a hash table to store data but stores the data in an unsorted fashion. HashMap.java Link: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/HashMap.java
HashMap is a faster, O(1) map that uses a hash table to store data but stores the data in an unsorted fashion. HashMap.java Link: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/HashMap.java
==TreeMap==


TreeMap is a slower, O(log N) map that uses a tree structure to store data in a sorted fashion. This provides faster access to max/min of data. TreeMap.java Link: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/TreeMap.java
TreeMap is a slower, O(log N) map that uses a tree structure to store data in a sorted fashion. This provides faster access to max/min of data. TreeMap.java Link: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/TreeMap.java
==LinkedHashMap==


There is also a LinkedHashMap, which implements a Hash Map using a linked structure: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/LinkedHashMap.java
There is also a LinkedHashMap, which implements a Hash Map using a linked structure: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/LinkedHashMap.java
==Hashtable==


The Hashtable class also provides a slimmed down version of a map - a straight hash table implementation arbitrary key-value types: http://docs.oracle.com/javase/7/docs/api/java/util/Hashtable.html
The Hashtable class also provides a slimmed down version of a map - a straight hash table implementation arbitrary key-value types: http://docs.oracle.com/javase/7/docs/api/java/util/Hashtable.html
=Flags=

Revision as of 05:14, 21 June 2017

Notes

Maps are implemented in Java as part of the Collections framework. These are notes from the source.

Here is a link to the OpenJDK source code, util module: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/

The Java Collections framework provides a number of different useful map-related classes.

AbstractMap

The top level class is an abstract class called AbstractMap.java: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/AbstractMap.java

Map

Next is the base map class Map.java: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/Map.java

HashMap

HashMap is a faster, O(1) map that uses a hash table to store data but stores the data in an unsorted fashion. HashMap.java Link: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/HashMap.java

TreeMap

TreeMap is a slower, O(log N) map that uses a tree structure to store data in a sorted fashion. This provides faster access to max/min of data. TreeMap.java Link: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/TreeMap.java

LinkedHashMap

There is also a LinkedHashMap, which implements a Hash Map using a linked structure: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/ff6c76f7733e/src/share/classes/java/util/LinkedHashMap.java

Hashtable

The Hashtable class also provides a slimmed down version of a map - a straight hash table implementation arbitrary key-value types: http://docs.oracle.com/javase/7/docs/api/java/util/Hashtable.html


Flags