diff options
| author | Andrew Gallasch <andrewgallasch@gmail.com> | 2017-10-30 23:55:56 +1030 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-30 23:55:56 +1030 | 
| commit | ab34af7c2da3cde96e5c1005c66f290001a15d48 (patch) | |
| tree | 022e38d09e70344ff11365bdc806499bdd59f6c5 | |
| parent | 506030135829b42217a182c7bce24452024a1fc3 (diff) | |
| parent | d1ed7e02da50f3e03e517175b1ff866332c049f2 (diff) | |
Merge pull request #2989 from adambard/bemusementpark-patch-1
Improve TreeMap documentation
| -rw-r--r-- | java.html.markdown | 16 | 
1 files changed, 11 insertions, 5 deletions
| diff --git a/java.html.markdown b/java.html.markdown index 621d500c..36d56625 100644 --- a/java.html.markdown +++ b/java.html.markdown @@ -280,7 +280,7 @@ public class LearnJava {          // LinkedLists - Implementation of doubly-linked list. All of the          //               operations perform as could be expected for a          //               doubly-linked list. -        // Maps - A set of objects that map keys to values. Map is +        // Maps - A mapping of key Objects to value Objects. Map is          //        an interface and therefore cannot be instantiated.          //        The type of keys and values contained in a Map must          //        be specified upon instantiation of the implementing @@ -289,10 +289,16 @@ public class LearnJava {          // HashMaps - This class uses a hashtable to implement the Map          //            interface. This allows the execution time of basic          //            operations, such as get and insert element, to remain -        //            constant even for large sets. -        // TreeMap - This class is a sorted tree structure. It implements a red -        //           black tree and sorts the entries based on the key value or -        //           the comparator provided while creating the object +        //            constant-amortized even for large sets. +        // TreeMap - A Map that is sorted by its keys. Each modification  +        //           maintains the sorting defined by either a Comparator +        //           supplied at instantiation, or comparisons of each Object +        //           if they implement the Comparable interface. +        //           Failure of keys to implement Comparable combined with failure to +        //           supply a Comparator will throw ClassCastExceptions. +        //           Insertion and removal operations take O(log(n)) time +        //           so avoid using this data structure unless you are taking +        //           advantage of the sorting.          ///////////////////////////////////////          // Operators | 
