ChemicalFilters { static Map<Integer, Double> sortMapByValueInAccendingOrder(Map<Integer, Double> map) { List<Map.Entry<Integer, Double>> list = new LinkedList<Map.Entry<Integer, Double>>(map.entrySet()); Collections.sort(list, new Comparator<Map.Entry<Integer, Double>>() { @Override public int compare(Map.Entry<Integer, Double> entry, Map.Entry<Integer, Double> entry1) { return (entry.getValue().equals(entry1.getValue()) ? 0 : (entry.getValue() > entry1.getValue() ? 1 : -1)); } }); Map<Integer, Double> result = new LinkedHashMap<Integer, Double>(); for (Iterator<Map.Entry<Integer, Double>> it = list.iterator(); it.hasNext();) { Map.Entry<Integer, Double> entry = it.next(); result.put(entry.getKey(), entry.getValue()); } return result; } ChemicalFilters(List<Map<Integer, Integer>> allMCS, List<Map<IAtom, IAtom>> allAtomMCS,
            Map<Integer, Integer> firstSolution, Map<IAtom, IAtom> firstAtomMCS, IAtomContainer sourceMol,
            IAtomContainer targetMol); synchronized void sortResultsByStereoAndBondMatch(); synchronized void sortResultsByFragments(); synchronized void sortResultsByEnergies(); List<Double> getSortedEnergy(); List<Integer> getSortedFragment(); List<Double> getStereoMatches(); static IBond.Order convertOrder(double srcOrder); static int convertBondOrder(IBond bond); static int convertBondStereo(IBond bond); static IBond.Stereo convertStereo(int stereoValue);  }
@Test public void testSortMapByValueInAccendingOrder() { Map<Integer, Double> map = new TreeMap<Integer, Double>(); map.put(1, 3.0); map.put(2, 2.0); map.put(3, 1.0); map.put(4, 4.0); Map<Integer, Double> expResult = new TreeMap<Integer, Double>(); expResult.put(3, 1.0); expResult.put(2, 2.0); expResult.put(1, 3.0); expResult.put(4, 4.0); Map<Integer, Double> result = ChemicalFilters.sortMapByValueInAccendingOrder(map); assertEquals(expResult, result); }