Are you tired of getting keywords from Map every time and getting the corresponding values? Using the Map. Entry class, you can get all the information at the same time. The standard Map access method is as follows: Set keys = map. keySet (); if (keys! = Null) {Iterator iterator = keys. iterator (); while (iterator. hasNext () {Object key = iterator. next (); Object value = map. get (key );;....;}} then there is a problem with this method. After obtaining keywords from Map, we must repeat the returned values to Map to obtain the relative values, which is cumbersome and time-consuming. Fortunately, there is a simpler way. The Map class provides a method called entrySet (), which returns an object set after Map. Entry instantiation. Next, the Map. Entry class provides a getKey () method and a getValue () method. Therefore, the above Code can be organized to be more logical. Example: Set entries = map. entrySet (); if (entries! = Null) {Iterator iterator = entries. iterator (); while (iterator. hasNext () {Map. entry entry = iterator. next (); Object key = entry. getKey (); Object value = entry. getValue ();;....}} although a line of code is added, we omit many unnecessary "get" calls to Map. At the same time, it provides developers with a class that maintains both the keyword and its corresponding value. Map. Entry also provides a setValue () method, which can be used by programmers to modify values in map. The internal arrangement of Hashtable is hash, so the output information is unordered. To ensure that the output data is arranged in sequence, do not use the built-in functions of java to adjust and process the Hashtable object. When we get the KEY and VALUE in Hashtable, we usually run the Map. Entry class for conversion. Well, now we use this class for writing. I have written a specific method. Code:/*** Method Name: getSortedHashtable * parameter: Hashtable h introduced to the processed hash list * Description: hashtable to be introduced. entrySet is sorted and */public static Map is returned. entry [] getSortedHashtable (Hashtable h) {Set = h. entrySet (); Map. entry [] entries = (Map. entry []) set. toArray (new Map. entry [set. size ()]); Arrays. sort (entries, new Comparator () {public int compare (Object arg0, Object arg1) {Object key1 = (Map. entry) arg0 ). getKey (); Object key2 = (Map. entry) arg1 ). getKey (); return (Comparable) key1 ). compareTo (key2) ;}}); return entries ;}call this method: Map. entry [] set = getSortedHashtable (t); // perportyTable for (int I = 0; I <set. length; I ++) {System. out. println (set [I]. getKey (). toString (); System. out. println (set [I]. getValue (). toString ());}