Class Pools

java.lang.Object
icyllis.modernui.util.Pools

public final class Pools extends Object
Helper class for creating pools of objects.
  • Method Details

    • newSimplePool

      @NonNull public static <T> Pools.Pool<T> newSimplePool(int maxPoolSize)
      Creates a simple (non-synchronized) pool of objects.
      Parameters:
      maxPoolSize - The max pool size.
      Throws:
      IllegalArgumentException - If the max pool size is less than zero.
    • newSynchronizedPool

      @NonNull public static <T> Pools.Pool<T> newSynchronizedPool(int maxPoolSize)
      Creates a synchronized pool of objects.
      Parameters:
      maxPoolSize - The max pool size.
      Throws:
      IllegalArgumentException - If the max pool size is less than zero.
    • newSynchronizedPool

      @NonNull public static <T> Pools.Pool<T> newSynchronizedPool(int maxPoolSize, @NonNull Object lock)
      Creates a synchronized pool of objects.
      Parameters:
      maxPoolSize - The max pool size.
      Throws:
      IllegalArgumentException - If the max pool size is less than zero.