diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-05-10 16:02:45 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-05-10 16:02:45 -0400 |
| commit | 61fd71f69e080790da722e0e03b71ecd7c2538a2 (patch) | |
| tree | e5c1150b27b84d550f807e44ac82688216451f00 /BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalMap.java | |
| parent | 87ae1dfc8d8cb7b51d7bda4750ce841bbe691cfc (diff) | |
General update
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalMap.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalMap.java | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalMap.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalMap.java deleted file mode 100644 index 8a54246..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IFunctionalMap.java +++ /dev/null @@ -1,137 +0,0 @@ -package bjc.utils.funcdata; - -import java.util.function.BiConsumer; -import java.util.function.Consumer; -import java.util.function.Function; - -/** - * Functional wrapper over map providing some useful things - * - * @author ben - * - * @param <KeyType> - * The type of this map's keys - * @param <ValueType> - * The type of this map's values - * - */ -public interface IFunctionalMap<KeyType, ValueType> { - - /** - * Check if this map contains the specified key - * - * @param key - * The key to check - * @return Whether or not the map contains the key - */ - boolean containsKey(KeyType key); - - /** - * Extends this map, creating a new map that will delegate queries to - * the map, but store any added values itself - * - * @return An extended map - */ - IFunctionalMap<KeyType, ValueType> extend(); - - /** - * Execute an action for each entry in the map - * - * @param action - * the action to execute for each entry in the map - */ - void forEach(BiConsumer<KeyType, ValueType> action); - - /** - * Perform an action for each key in the map - * - * @param action - * The action to perform on each key in the map - */ - void forEachKey(Consumer<KeyType> action); - - /** - * Perform an action for each value in the map - * - * @param action - * The action to perform on each value in the map - */ - void forEachValue(Consumer<ValueType> action); - - /** - * Get the value assigned to the given key - * - * @param key - * The key to look for a value under - * @return The value of the key - * - * - */ - ValueType get(KeyType key); - - /** - * Get the number of entries in this map - * - * @return The number of entries in this map - */ - int getSize(); - - /** - * Get a list of all the keys in this map - * - * @return A list of all the keys in this map - */ - IFunctionalList<KeyType> keyList(); - - /** - * Transform the values returned by this map. - * - * NOTE: This transform is applied once for each lookup of a value, so - * the transform passed should be a proper function, or things will - * likely not work as expected. - * - * @param <V2> - * The new type of returned values - * @param transformer - * The function to use to transform values - * @return The map where each value will be transformed after lookup - */ - <V2> IFunctionalMap<KeyType, V2> mapValues( - Function<ValueType, V2> transformer); - - /** - * Add an entry to the map - * - * @param key - * The key to put the value under - * @param val - * The value to add - * @return The previous value of the key in the map, or null if the key - * wasn't in the map. However, note that it may also return - * null if the key was set to null. - * - * @throws UnsupportedOperationException - * if the map implementation doesn't support modifying the - * map - */ - ValueType put(KeyType key, ValueType val); - - /** - * Remove the value bound to the key - * - * @param key - * The key to remove from the map - * @return The previous value for the key in the map, or null if the - * key wasn't in the class. NOTE: Just because you recieved - * null, doesn't mean the map wasn't changed. It may mean that - * someone put a null value for that key into the map - */ - ValueType remove(KeyType key); - - /** - * Get a list of the values in this map - * - * @return A list of values in this map - */ - IFunctionalList<ValueType> valueList(); -}
\ No newline at end of file |
