diff options
Diffstat (limited to 'src/main/java/bjc/esodata')
| -rw-r--r-- | src/main/java/bjc/esodata/AbbrevMap2.java | 9 | ||||
| -rw-r--r-- | src/main/java/bjc/esodata/Multimap.java | 4 | ||||
| -rw-r--r-- | src/main/java/bjc/esodata/Stack.java | 2 | ||||
| -rw-r--r-- | src/main/java/bjc/esodata/ThresholdSet.java | 5 |
4 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/bjc/esodata/AbbrevMap2.java b/src/main/java/bjc/esodata/AbbrevMap2.java index f79a2d2..db41471 100644 --- a/src/main/java/bjc/esodata/AbbrevMap2.java +++ b/src/main/java/bjc/esodata/AbbrevMap2.java @@ -3,7 +3,14 @@ package bjc.esodata; import java.util.*; /** - * A revised version of {@link AbbrevMap} + * A map that allows you to reference strings by unambiguous abbreviations to them. + * + * One example is that adding the string 'abc' would allow you to get it back with the following three keys + * <ul> + * <li>a</li> + * <li>ab</li> + * <li>abc</li> + * </ul> * * @author Ben Culkin */ diff --git a/src/main/java/bjc/esodata/Multimap.java b/src/main/java/bjc/esodata/Multimap.java index bb41b03..5706db3 100644 --- a/src/main/java/bjc/esodata/Multimap.java +++ b/src/main/java/bjc/esodata/Multimap.java @@ -2,8 +2,6 @@ package bjc.esodata; import java.util.*; -import bjc.data.*; - /** * A map that has support for multiple values for a given key. * @@ -34,7 +32,7 @@ public class Multimap<KeyType, ValueType> { */ public void add(KeyType key, ValueType value) { ThresholdSet<ValueType> container = backing.computeIfAbsent(key, - (k) -> new ThresholdSet()); + (k) -> new ThresholdSet<>()); container.add(value); } diff --git a/src/main/java/bjc/esodata/Stack.java b/src/main/java/bjc/esodata/Stack.java index 1a15764..31c92f1 100644 --- a/src/main/java/bjc/esodata/Stack.java +++ b/src/main/java/bjc/esodata/Stack.java @@ -125,7 +125,7 @@ public abstract class Stack<T> { public List<T> multipop(int n) { List<T> lst = new LinkedList<>(); - for (int i = 0; i < n; n++) { + for (int i = 0; i < n; i++) { lst.add(pop()); } diff --git a/src/main/java/bjc/esodata/ThresholdSet.java b/src/main/java/bjc/esodata/ThresholdSet.java index cc7c0e1..6076a2a 100644 --- a/src/main/java/bjc/esodata/ThresholdSet.java +++ b/src/main/java/bjc/esodata/ThresholdSet.java @@ -2,8 +2,6 @@ package bjc.esodata; import java.util.*; -import bjc.data.*; - /** * Represents a counted set, that overflows to a map. * @@ -97,7 +95,7 @@ public class ThresholdSet<KeyType> { /** * Add multiple keys at once to the map. * - * @param key + * @param keys * The keys to add. * * @return An array containing the results of adding the keys. @@ -260,6 +258,7 @@ public class ThresholdSet<KeyType> { * @param keys * The initial keys to add to the threshold set. */ + @SafeVarargs public static <KType> ThresholdSet<KType> TS(KType... keys) { ThresholdSet<KType> ts = new ThresholdSet<>(); |
