diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-07-10 17:10:51 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-07-10 17:10:51 -0400 |
| commit | e401fb037c555eb18db54708037a796523258c32 (patch) | |
| tree | 78aa519089a71fe056524abdc28af4894e2640cd /src/main/java/bjc/esodata/ThresholdSet.java | |
| parent | 4d0a59a0023f2b4fca144a089a3f75acb4ebd62b (diff) | |
General improvements to stack
Diffstat (limited to 'src/main/java/bjc/esodata/ThresholdSet.java')
| -rw-r--r-- | src/main/java/bjc/esodata/ThresholdSet.java | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/main/java/bjc/esodata/ThresholdSet.java b/src/main/java/bjc/esodata/ThresholdSet.java index bc1b517..245eb5f 100644 --- a/src/main/java/bjc/esodata/ThresholdSet.java +++ b/src/main/java/bjc/esodata/ThresholdSet.java @@ -57,7 +57,7 @@ public class ThresholdSet<KeyType> { // Will throw a ClassCastException if you give us something bad. KeyType k = (KeyType)o; - int ret = ThresholdSet.this.remove(k); + int ret = ThresholdSet.this.contains(k); // The object is set-visible if (ret == 1) return true; @@ -235,6 +235,32 @@ public class ThresholdSet<KeyType> { return new SetView(); } + /** + * Static threshold set constructor. + * + * @param keys + * The initial keys to add to the threshold set. + */ + public static <KType> ThresholdSet<KType> TS(KType... keys) { + ThresholdSet<KType> ts = new ThresholdSet<>(); + + ts.addKeys(keys); + + return ts; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + + sb.append("Set: "); + sb.append(keySet); + sb.append("\nMap: "); + sb.append(keyMap); + + return sb.toString(); + } + // Implementation methods for setView int setSize() { |
