diff --git a/Level/src/bskyblock/addin/level/util/MapUtil.java b/Level/src/bskyblock/addin/level/util/MapUtil.java deleted file mode 100644 index 5d7f65c..0000000 --- a/Level/src/bskyblock/addin/level/util/MapUtil.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * This file is part of ASkyBlock. - * - * ASkyBlock is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ASkyBlock is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ASkyBlock. If not, see . - *******************************************************************************/ -package bskyblock.addin.level.util; - -import java.util.Collections; -import java.util.Comparator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * @author tastybento - */ -public class MapUtil { - /** - * Sorts map in descending order - * - * @param map - * @return - */ - public static > LinkedHashMap sortByValue(Map map) { - List> list = new LinkedList>(map.entrySet()); - Collections.sort(list, new Comparator>() { - public int compare(Map.Entry o1, Map.Entry o2) { - // Switch these two if you want ascending - return (o2.getValue()).compareTo(o1.getValue()); - } - }); - - LinkedHashMap result = new LinkedHashMap(); - for (Map.Entry entry : list) { - result.put(entry.getKey(), entry.getValue()); - if (result.size() > 20) - break; - } - return result; - } -}