textbender.g
Class InstanceList
java.lang.Object
InstanceList
public class InstanceList
- extends Object
Utilities for instance lists.
Method Summary |
static
|
register(I i,
List<I> iList,
Spool spool)
Registers an instance, and spools it to be unregistered on disposal. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
register
public static <I> int register(I i,
List<I> iList,
Spool spool)
- Registers an instance, and spools it to be unregistered on disposal.
The instance is stored in place of the first null element in the list;
or, if there is no null element, an element is appended to the end of the list.
When unspooled, that element is set to null, effectively unregistering the instance.
- Parameters:
i
- instance to registeriList
- list in which to register instancespool
- for internal holds. When unwound, this instance
releases its internal holds, and is thence disabled.
- Returns:
- index at which instance is registered in the list
- Throws:
AssertionError
- on attempt to double-register an instance