|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjml.utils.Utility
public class Utility
The Utility
class provides some frequently used functions
for text processing.
Nested Class Summary | |
---|---|
static class |
Utility.ArrayIndexComparator<V extends java.lang.Comparable<? super V>>
A generic Class that implements Comparator |
static class |
Utility.keyAscendComparator<K extends java.lang.Comparable<K>>
Generic comparator for TreeMap to sort the keys in a increasing order. |
static class |
Utility.keyDescendComparator<K extends java.lang.Comparable<K>>
Generic comparator for TreeMap to sort the keys in a decreasing order. |
Constructor Summary | |
---|---|
Utility()
|
Method Summary | ||
---|---|---|
static
|
sortByKey(java.util.Map<K,V> map,
java.lang.String order)
Sort a map by its keys according to a specified order. |
|
static
|
sortByKeys(java.util.Map<K,V> map,
java.lang.String order)
Sort a map by its keys according to a specified order. |
|
static
|
sortByValue(java.util.Map<K,V> map,
java.lang.String order)
Sort a map by its values according to a specified order. |
|
static
|
sortByValues(java.util.Map<K,V> map,
java.lang.String order)
Sort a map by its values according to a specified order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Utility()
Method Detail |
---|
public static <K extends java.lang.Comparable<K>,V> java.util.Map<K,V> sortByKeys(java.util.Map<K,V> map, java.lang.String order)
TreeMap
but not
HashMap
. The input map can be any map.
K
- Class type for the key in the map.V
- Class type for the value in the map.map
- The map to be sorted.order
- The String
indicating the order by which the map
to be sorted, either "descend" or "ascend".
TreeMap
by the order specified by .public static <K,V extends java.lang.Comparable<V>> java.util.Map<K,V> sortByValues(java.util.Map<K,V> map, java.lang.String order)
TreeMap
but not
HashMap
. The input map can be any map.
K
- Class type for the key in the map.V
- Class type for the value in the map.map
- The map to be sorted.order
- The String
indicating the order by which the map
to be sorted, either "descend" or "ascend".
TreeMap
by the order specified by .public static <K,V extends java.lang.Comparable<? super V>> java.util.Map<K,V> sortByValue(java.util.Map<K,V> map, java.lang.String order)
HashMap
but not TreeMap
.
K
- Class type for the key in the map.V
- Class type for the value in the map.map
- The map to be sorted which can be TreeMap
or HashMap
.order
- The String
indicating the order by which the map
to be sorted, either "descend" or "ascend".
TreeMap
by the order specified by .public static <K extends java.lang.Comparable<? super K>,V> java.util.Map<K,V> sortByKey(java.util.Map<K,V> map, java.lang.String order)
HashMap
but not TreeMap
.
K
- Class type for the key in the map.V
- Class type for the value in the map.map
- The map to be sorted which can be TreeMap
or HashMap
.order
- The String
indicating the order by which the map
to be sorted, either "descend" or "ascend".
TreeMap
by the order specified by .
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |