Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lejos.util
Class ArrayRecycler

    java.lang.Object
      lejos.util.Recycler
          lejos.util.ArrayRecycler

    public final class ArrayRecycler

extends Recycler

An array recycler for Object arrays. To use this utility, create a global instance of this class, and then invoke `allocate(int)` to create recyclable arrays. As usual, invoke `recycle(...)` to release the array.

Note that the caller is expected to provide thread safety for instances of this class.

See Also:
  `RecyclableArray`

Constructor Summary
`ArrayRecycler()` Constructs a recycler.

Method Summary
`RecyclableArray` | `allocate(int length)` Attempts to obtain a free RecyclableArray.
`protected Recyclable` | `createInstance()` This is a factory method that should be overridden to create an Recyclable object instance.

Methods inherited from class lejos.util.Recycler
`allocate, recycle`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait`

Constructor Detail

### ArrayRecycler

    public ArrayRecycler()

  Constructs a recycler.

Method Detail

### allocate

    public final RecyclableArray allocate(int length)

  Attempts to obtain a free RecyclableArray.

  Returns:
    A RecyclableArray reference.
  Throws:
    `StackOverflowError` - May be thrown due to the recursive implementation of the method.

### createInstance

    protected final Recyclable createInstance()

  Description copied from class: `Recycler`
  This is a factory method that should be overridden to create an Recyclable object instance.

  Specified by:
    `createInstance` in class `Recycler`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD