diff --git a/src/main/java/xyz/zhouxy/plusone/commons/collection/ListTools.java b/src/main/java/xyz/zhouxy/plusone/commons/collection/ListTools.java deleted file mode 100644 index 1ff2972..0000000 --- a/src/main/java/xyz/zhouxy/plusone/commons/collection/ListTools.java +++ /dev/null @@ -1,15 +0,0 @@ -package xyz.zhouxy.plusone.commons.collection; - -import java.util.List; -import java.util.function.Function; - -public class ListTools { - - public static void transformValue(List list, int index, Function func) { - list.set(index, func.apply(list.get(index))); - } - - private ListTools() { - throw new IllegalStateException("Utility class"); - } -} diff --git a/src/main/java/xyz/zhouxy/plusone/commons/collection/MapTools.java b/src/main/java/xyz/zhouxy/plusone/commons/collection/MapTools.java deleted file mode 100644 index f96dab8..0000000 --- a/src/main/java/xyz/zhouxy/plusone/commons/collection/MapTools.java +++ /dev/null @@ -1,17 +0,0 @@ -package xyz.zhouxy.plusone.commons.collection; - -import java.util.Map; -import java.util.function.Function; - -public class MapTools { - - public static void transformValue(Map map, K key, Function func) { - if (map.containsKey(key)) { - map.put(key, func.apply(map.get(key))); - } - } - - private MapTools() { - throw new IllegalStateException("Utility class"); - } -} diff --git a/src/main/java/xyz/zhouxy/plusone/commons/collection/TableTools.java b/src/main/java/xyz/zhouxy/plusone/commons/collection/TableTools.java deleted file mode 100644 index 0070b05..0000000 --- a/src/main/java/xyz/zhouxy/plusone/commons/collection/TableTools.java +++ /dev/null @@ -1,17 +0,0 @@ -package xyz.zhouxy.plusone.commons.collection; - -import com.google.common.collect.Table; - -public class TableTools { - - public static Table synchronizedTable(Table t) { - if (t instanceof SynchronizedTable) { - return t; - } - return SynchronizedTable.of(t); - } - - private TableTools() { - throw new IllegalStateException("Utility class"); - } -} diff --git a/src/main/java/xyz/zhouxy/plusone/commons/util/ArrayTools.java b/src/main/java/xyz/zhouxy/plusone/commons/util/ArrayTools.java index c5d7bd3..2fd3849 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/util/ArrayTools.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/util/ArrayTools.java @@ -17,23 +17,14 @@ package xyz.zhouxy.plusone.commons.util; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import java.util.function.Function; import javax.annotation.Nullable; import com.google.common.annotations.Beta; -import xyz.zhouxy.plusone.commons.collection.CollectionTools; -import xyz.zhouxy.plusone.commons.collection.SafeConcurrentHashMap; - @Beta public class ArrayTools { @@ -186,61 +177,6 @@ public class ArrayTools { return result; } - // array -> map - - public static HashMap toHashMap( - V[] c, - Function keyGenerator, - int initialCapacity) { - HashMap map = new HashMap<>(initialCapacity); - fillIntoEmptyMap(map, c, keyGenerator); - return map; - } - - public static HashMap toHashMap( - V[] c, - Function keyGenerator) { - return toHashMap(c, keyGenerator, c.length); - } - - public static SafeConcurrentHashMap toConcurrentHashMap( - V[] c, - Function keyGenerator, - int initialCapacity) { - SafeConcurrentHashMap map = new SafeConcurrentHashMap<>(initialCapacity); - fillIntoEmptyMap(map, c, keyGenerator); - return map; - } - - public static SafeConcurrentHashMap toConcurrentHashMap( - V[] c, - Function keyGenerator) { - return toConcurrentHashMap(c, keyGenerator, c.length); - } - - public static , V> TreeMap toTreeMap( - V[] c, - Function keyGenerator) { - TreeMap map = new TreeMap<>(); - fillIntoEmptyMap(map, c, keyGenerator); - return map; - } - - public static TreeMap toTreeMap( - V[] c, - Function keyGenerator, - Comparator keyComparator) { - TreeMap map = new TreeMap<>(keyComparator); - fillIntoEmptyMap(map, c, keyGenerator); - return map; - } - - public static void fillIntoEmptyMap( - Map map, V[] c, - Function keyGenerator) { - CollectionTools.fillIntoEmptyMap(map, Arrays.asList(c), keyGenerator); - } - private ArrayTools() { throw new IllegalStateException("Utility class"); }