Adds the specified number of new free objects to the pool. Usually called early on as a pre-allocation mechanism but can be used at any time. @param size the number of objects to be added
(int size)
| 73 | * |
| 74 | * @param size the number of objects to be added */ |
| 75 | public void fill (int size) { |
| 76 | for (int i = 0; i < size; i++) |
| 77 | if (freeObjects.size < max) freeObjects.add(newObject()); |
| 78 | peak = Math.max(peak, freeObjects.size); |
| 79 | } |
| 80 | |
| 81 | /** Called when an object is freed to clear the state of the object for possible later reuse. The default implementation calls |
| 82 | * {@link Poolable#reset()} if the object is {@link Poolable}. */ |