Class ObjectPool<T>

java.lang.Object
net.minestom.server.utils.ObjectPool<T>

@Internal @Experimental public final class ObjectPool<T> extends Object
  • Method Details

    • pool

      public static <T> ObjectPool<T> pool(Supplier<T> supplier, UnaryOperator<T> sanitizer)
    • pool

      public static <T> ObjectPool<T> pool(Supplier<T> supplier)
    • get

      @NotNull public T get()
    • getAndRegister

      @NotNull public T getAndRegister(@NotNull @NotNull Object ref)
    • add

      public void add(@NotNull T object)
    • clear

      public void clear()
    • count

      public int count()
    • register

      public void register(@NotNull @NotNull Object ref, @NotNull @NotNull AtomicReference<T> objectRef)
    • register

      public void register(@NotNull @NotNull Object ref, @NotNull T object)
    • register

      public void register(@NotNull @NotNull Object ref, @NotNull @NotNull Collection<T> objects)
    • hold

      @NotNull public ObjectPool<T>.@NotNull Holder hold()
    • use

      public <R> R use(@NotNull @NotNull Function<@NotNull T,R> function)