Class KeyChain<T extends Keyed>
java.lang.Object
dev.wyck.keys.KeyChain<T>
- Type Parameters:
T- the type of the items in the chain
-
Method Summary
Modifier and TypeMethodDescriptionvoidAppends an item to the chain.Gets the item associated with the given key.Gets the item associated with the given key, or returns a lazy that will return null if not found.getOrThrow(Key key) Gets the item associated with the given key, or throws an exception if not found.getOrThrowLazily(Key key) Gets the item associated with the given key, or throws an exception if not found.Creates a new immutable KeyChain.booleanisEmpty()Returns true if the chain is empty.booleanisRegistered(Key key) Checks if the given key is registered.isRegisteredLazily(Key key) Returns a lazy that will return true if the given key is registered, false otherwise.items()Returns a copy of the items in the chain.iterator()Returns an iterator over the items in the chain.mutable()Creates a new mutable KeyChain.booleanReplaces an existing key in the chain with a new item.intsize()Returns the number of items in the chain.
-
Method Details
-
get
Gets the item associated with the given key.- Parameters:
key- the key to get the item for- Returns:
- the item associated with the given key, or null if not found
- Throws:
IllegalArgumentException- if the item is not found- Since:
- 2.4.0
-
getOrThrow
Gets the item associated with the given key, or throws an exception if not found.- Parameters:
key- the key to get the item for- Returns:
- the item associated with the given key
- Throws:
IllegalArgumentException- if the item is not found- Since:
- 2.4.0
-
getLazily
Gets the item associated with the given key, or returns a lazy that will return null if not found.- Parameters:
key- the key to get the item for- Returns:
- a lazy that will return the item associated with the given key, or null if not found
- Since:
- 2.4.0
-
getOrThrowLazily
-
isRegistered
-
isRegisteredLazily
-
iterator
-
size
Returns the number of items in the chain.- Returns:
- the number of items in the chain
- Since:
- 2.4.0
-
isEmpty
Returns true if the chain is empty.- Returns:
- true if the chain is empty
- Since:
- 2.4.0
-
items
-
append
-
replace
-
mutable
-
immutable
-