Package org.javlo.helper
Class MapHelper
- java.lang.Object
-
- org.javlo.helper.MapHelper
-
public class MapHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(String[] args)static <K,V extends Comparable<? super V>>
Map<K,V>sameSorting(Map<K,V> map, Map<K,V> reference)sort map with the same sorting than other map and remove key not found in reference.static <V extends Comparable<? super V>>
Map<String,V>sameSortingNormilized(Map<String,V> map, Map<String,V> reference)sort map with the same sorting than other map and remove key not found in reference.static <K,V extends Comparable<? super V>>
Map<K,V>sortByValue(Map<K,V> map)static <K,V extends Comparable<? super V>>
Map<K,V>sortByValue(Map<K,V> map, boolean ascending)sort map on value
-
-
-
Method Detail
-
sortByValue
public static <K,V extends Comparable<? super V>> Map<K,V> sortByValue(Map<K,V> map)
-
sortByValue
public static <K,V extends Comparable<? super V>> Map<K,V> sortByValue(Map<K,V> map, boolean ascending)
sort map on value- Type Parameters:
K-V-- Parameters:
map-ascending-- Returns:
- a ordered map sorted on value
-
sameSorting
public static <K,V extends Comparable<? super V>> Map<K,V> sameSorting(Map<K,V> map, Map<K,V> reference)
sort map with the same sorting than other map and remove key not found in reference.- Type Parameters:
K-V-- Parameters:
map- map to sortreference- ordered map with key order reference- Returns:
- new ordered map with same order than reference
-
sameSortingNormilized
public static <V extends Comparable<? super V>> Map<String,V> sameSortingNormilized(Map<String,V> map, Map<String,V> reference)
sort map with the same sorting than other map and remove key not found in reference.- Type Parameters:
String-V-- Parameters:
map- map to sortreference- ordered map with key order reference- Returns:
- new ordered map with same order than reference
-
main
public static void main(String[] args)
-
-