Package org.fxmisc.flowless
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 java.lang.Object
Helper class that stores a pool of reusable cells that can be updated viaCell.updateItem(Object)
or creates new ones via itscellFactory
if the pool is empty.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Function<? super T,? extends C>
cellFactory
private java.util.Queue<C>
pool
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptCell(C cell)
Adds the cell to the pool of reusable cells ifCell.isReusable()
is true, ordisposes
the cell if it's not.void
dispose()
Disposes the cell pool and prevents any memory leaks.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 itscellFactory
.
-
-
-
Method Detail
-
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 itscellFactory
.
-
acceptCell
public void acceptCell(C cell)
Adds the cell to the pool of reusable cells ifCell.isReusable()
is true, ordisposes
the cell if it's not.
-
dispose
public void dispose()
Disposes the cell pool and prevents any memory leaks.
-
-