diff --git a/src/main/java/com/gtnewhorizon/structurelib/util/SortedRegistry.java b/src/main/java/com/gtnewhorizon/structurelib/util/SortedRegistry.java deleted file mode 100644 index aeb2f8c8..00000000 --- a/src/main/java/com/gtnewhorizon/structurelib/util/SortedRegistry.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.gtnewhorizon.structurelib.util; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.NavigableMap; -import java.util.Spliterator; -import java.util.TreeMap; -import java.util.function.Consumer; - -public class SortedRegistry implements Iterable { - - private final NavigableMap store = new TreeMap<>(); - /** - * Store stuff in an array for faster iteration access than a red black tree - */ - private List baked = Collections.emptyList(); - - public void register(String key, V val) { - if (key == null || val == null) throw new NullPointerException(); - V old = store.putIfAbsent(key, val); - if (old != null) { - throw new IllegalArgumentException("Duplicate key: " + key); - } - // TODO allow a user to edit the order with a configuration file - baked = new ArrayList<>(store.values()); - } - - public int size() { - return store.size(); - } - - public boolean isEmpty() { - return store.isEmpty(); - } - - public boolean containsKey(String key) { - return store.containsKey(key); - } - - public boolean containsValue(V value) { - return store.containsValue(value); - } - - public V get(String key) { - return store.get(key); - } - - @Override - public Iterator iterator() { - return baked.iterator(); - } - - @Override - public void forEach(Consumer action) { - baked.forEach(action); - } - - @Override - public Spliterator spliterator() { - return baked.spliterator(); - } -}