Java List Sort sortMap(Map targetMap, List sortedList)

Here you can find the source of sortMap(Map targetMap, List sortedList)

Description

sort Map

License

Apache License

Declaration

public static <K, V> Map<K, V> sortMap(Map<K, V> targetMap, List<K> sortedList) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class Main {
    public static <K, V> Map<K, V> sortMap(Map<K, V> targetMap, List<K> sortedList) {
        LinkedHashMap sortedMap = new LinkedHashMap();
        Iterator var3 = sortedList.iterator();

        while (var3.hasNext()) {
            Object k = var3.next();
            if (targetMap.get(k) != null) {
                sortedMap.put(k, targetMap.get(k));
            }/*from   w w  w .  j  ava 2 s . c o m*/
        }

        return sortedMap;
    }
}

Related

  1. sortListOfDoublesAndRemoveDuplicates(List items, double tolerance, double toleranceSmallNumbers)
  2. sortListStingArrayByFirstDes( List list)
  3. sortLocales(final List locales)
  4. sortLongSeqList(List firstList, List secondList)
  5. sortLoops(ArrayList list)
  6. sortMapEntryListByValue(List> entries, boolean descending)
  7. sortMessages(List ms)
  8. sortNames(List nameLs, String splitStr)
  9. sortRepositorynames(List list)