Interface JavaRegistry<T>
- Type Parameters:
T- the type of this registry
- All Superinterfaces:
Iterable<T>,JavaRegistryLookup<T>
- All Known Subinterfaces:
MutableJavaRegistry<T>
- All Known Implementing Classes:
SimpleJavaRegistry
Extends
JavaRegistryLookup with methods to iterate over a registry's contents.
This interface extends Iterable, making it usable in for-loops and with Iterable.forEach(Consumer).
The iterator provided by instances is sorted by network ID.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidforEachEntry(Consumer<RegistryEntryData<T>> action) Iteratesactionfor eachRegistryEntryDataof this registry.default booleanisEmpty()Collection<net.kyori.adventure.key.Key> keys()Returns a collection of all keys in this registry.intsize()default Spliterator<T> stream()Methods inherited from interface org.geysermc.geyser.registry.java.JavaRegistryLookup
get, get, getById, getByKey, getByValue, getId, getId, getIdOrThrow, getIdOrThrow, getKey, getKey, getKeyOrThrow, getKeyOrThrow, getOrThrow, getOrThrow
-
Method Details
-
keys
Collection<net.kyori.adventure.key.Key> keys()Returns a collection of all keys in this registry.Note that this collection may not necessarily be sorted by network ID.
- Returns:
- a collection of all keys in this registry
-
isEmpty
default boolean isEmpty()- Returns:
- true if this registry is empty
-
size
int size()- Returns:
- the amount of entries in this registry
-
forEachEntry
Iteratesactionfor eachRegistryEntryDataof this registry.The action is executed in order of network ID.
- Parameters:
action- the action to execute for eachRegistryEntryData
-
spliterator
- Specified by:
spliteratorin interfaceIterable<T>
-
stream
- Returns:
- a stream iterating over all the entries in this registry, sorted by network ID
-
parallelStream
- Returns:
- a parallel stream iterating over all the entries in this registry, sorted by network ID
-