get method

T get()

Returns an instance of Poolable. If get() is called with an empty pool, the pool will be replenished. If the pool capacity is sufficiently large, this could come at a performance cost.

@return An instance of Poolable object T

Implementation

T get() {
  if (this.objectsPointer == -1 && this.replenishPercentage! > 0.0) {
    this.refillPool1();
  }

  T result = objects[this.objectsPointer] as T;
  result.currentOwnerId = PoolAble.NO_OWNER;
  this.objectsPointer--;

  return result;
}