Class CellPool<T,C extends Cell<T,?>>

java.lang.Object
org.fxmisc.flowless.CellPool<T,C>

final class CellPool<T,C extends Cell<T,?>> extends Object
Helper class that stores a pool of reusable cells that can be updated via Cell.updateItem(Object) or creates new ones via its cellFactory if the pool is empty.
  • Field Details

    • cellFactory

      private final Function<? super T,? extends C extends Cell<T,?>> cellFactory
    • pool

      private final Queue<C extends Cell<T,?>> pool
  • Constructor Details

    • CellPool

      public CellPool(Function<? super T,? extends C> cellFactory)
  • Method Details

    • getCell

      public C getCell(T item)
      Returns a reusable cell that has been updated with the current item if the pool has one, or returns a newly-created one via its cellFactory.
    • acceptCell

      public void acceptCell(C cell)
      Adds the cell to the pool of reusable cells if Cell.isReusable() is true, or disposes the cell if it's not.
    • dispose

      public void dispose()
      Disposes the cell pool and prevents any memory leaks.