public interface KeySet extends java.util.Set<Key>
Set
implementation for handling keys.
The difference between this set and a regular Set
is that this set handles checks for
global keys as well as individual ones.
For example, if this set has "STONE" as a key inside it, the Set.contains(Object)
method will return true
if "STONE" is provided, as well as any other key with a different sub-key ("STONE:0", for example).
However, if this set only has "STONE:0" as a key inside it, the Set.contains(Object)
method will only return
true for the exact same keys (Therefore, "STONE" will return false alongside of any other key with a different
sub-key)
Modifier and Type | Method and Description |
---|---|
java.util.Set<Key> |
asSet()
Return a regular
HashSet with the keys of this set. |
static KeySet |
createKeySet()
Create a new empty
KeySet instance based on HashSet |
static KeySet |
createKeySet(java.util.Collection<Key> collection)
Create a new
KeySet instance from the given collection based on HashSet . |
static KeySet |
createKeySet(java.util.function.Supplier<java.util.Set<java.lang.String>> setCreator)
Create a new empty
KeySet instance. |
Key |
getKey(Key original)
Get the key that is similar to the provided key.
|
Key |
getKey(Key original,
Key def)
Get the key that is similar to the provided key.
|
static KeySet createKeySet(java.util.function.Supplier<java.util.Set<java.lang.String>> setCreator)
KeySet
instance.setCreator
- The set creator for the inner-set of the new KeySet
static KeySet createKeySet(java.util.Collection<Key> collection)
KeySet
instance from the given collection based on HashSet
.
If the provided collection is also a KeySet
, the exact same instance of that set is returned.
Otherwise, the returned KeySet
is a copy of that collection.collection
- The collection to create KeySet
from.@Nullable Key getKey(Key original)
original
- The original key.Key getKey(Key original, Key def)
original
- The original key.def
- Default key to be returned if is not in the map.java.util.Set<Key> asSet()
HashSet
with the keys of this set.