public interface Allocator<T extends Recyclable>
Allocator
is responsible for returning to the caller a Reference
to a reusable
object or to provide a newly-created object, depending on the underlying allocation strategy.Modifier and Type | Method and Description |
---|---|
Reference<T> |
allocate()
Allocate an object from the internal pool.
|
List<Reference<T>> |
allocateBatch(int size)
Allocate a batch of objects all at once.
|
void |
release(List<Reference<T>> batch)
Efficiently release a batch of References all at once.
|
Reference<T> allocate()
Reference
that can be retained and released.List<Reference<T>> allocateBatch(int size)
size
- the number of objects to allocateList
of References
to the allocated objectsCopyright © 2017. All rights reserved.