Interface RegistrySet<T>

Type Parameters:
T - registry value type
All Known Subinterfaces:
RegistryKeySet<T>, RegistryValueSet<T>, Tag<T>

@Experimental @NullMarked public sealed interface RegistrySet<T> permits RegistryKeySet<T>, RegistryValueSet<T>
Represents a collection tied to a registry.

There are 2 types of registry sets:

  • Method Details

    • keySetFromValues

      @Contract(value="_, _ -> new", pure=true) static <T extends Keyed> RegistryKeySet<T> keySetFromValues(RegistryKey<T> registryKey, Iterable<? extends T> values)
      Creates a RegistryKeySet from registry-backed values.

      All values provided must have keys in the given registry.

      If references to actual objects are not available yet, use keySet(RegistryKey, Iterable) to create an equivalent RegistryKeySet using just TypedKeys.

      Type Parameters:
      T - the type of the values
      Parameters:
      registryKey - the registry key for the owner of these values
      values - the values
      Returns:
      a new registry set
      Throws:
      IllegalArgumentException - if the registry isn't available yet or if any value doesn't have a key in that registry
    • keySet

      @SafeVarargs static <T extends Keyed> RegistryKeySet<T> keySet(RegistryKey<T> registryKey, TypedKey<T>... keys)
      Creates a direct RegistrySet from TypedKeys.
      Type Parameters:
      T - the type of the values
      Parameters:
      registryKey - the registry key for the owner of these keys
      keys - the keys for the values
      Returns:
      a new registry set
    • keySet

      @Contract(value="_, _ -> new", pure=true) static <T extends Keyed> RegistryKeySet<T> keySet(RegistryKey<T> registryKey, Iterable<TypedKey<T>> keys)
      Creates a direct RegistrySet from TypedKeys.
      Type Parameters:
      T - the type of the values
      Parameters:
      registryKey - the registry key for the owner of these keys
      keys - the keys for the values
      Returns:
      a new registry set
    • registryKey

      RegistryKey<T> registryKey()
      Get the registry key for this set.
      Returns:
      the registry key
    • size

      int size()
      Get the size of this set.
      Returns:
      the size
    • isEmpty

      default boolean isEmpty()
      Checks if the registry set is empty.
      Returns:
      true, if empty