Top Description Fields Constructors Methods
org.fxmisc.flowless

pack-priv final Class CellPool<T, C extends Cell<T, ?>>

extends Object
Class Inheritance
Imports
java.util.LinkedList, .Queue, java.util.function.Function

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 Summary

Modifier and TypeField and Description
private final Function<? super T, ? extends C>
private final Queue<C>

Constructor Summary

AccessConstructor and Description
public
CellPool(Function<? super T, ? extends C> cellFactory)

Method Summary

Modifier and TypeMethod and Description
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.

public void
dispose()

Disposes the cell pool and prevents any memory leaks.

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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cellFactoryback to summary
private final Function<? super T, ? extends C> cellFactory
poolback to summary
private final Queue<C> pool

Constructor Detail

CellPoolback to summary
public CellPool(Function<? super T, ? extends C> cellFactory)

Method Detail

acceptCellback to summary
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.

disposeback to summary
public void dispose()

Disposes the cell pool and prevents any memory leaks.

getCellback to summary
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.