swarm.collections
Interface List
- All Known Implementing Classes:
- ListImpl
- public abstract interface List
- extends CollectionS, Collection
Collection of members in an externally assigned linear sequence..
A list is a collection of members that are all maintained at some externally assigned position in a linear sequence of all members. The sequence is established by the position at which members are added: members can be added at the start of list, at the end, or at any point in the middle. A list is also one of the most dynamic of basic collections, in that the cost of adding and removing members is very low. Members can be removed from any position just as easily as they can be added. A list automatically grows and shrinks to reflect the number of members at any one time, and there is no fixed capacity which limits the size to which a list may grow. The List type is supports all messages of Collection. If created with default options, it provides no special speedup of accesses by integer offset. Unless the EndsOnly option is specified, the default value of IndexSafety is UnsafeAtMember. This means that indexes are inherently safe under all operations except those which affect the member at an index or immediately adjacent to an index between members. If the EndsOnly option is specified, the default value of IndexSafety is Unsafe. In this case, indexes could be invalidated by any operation that adds or removes members. The SafeAlways can be specified for any case to get a guarantee of full index safety.
Method Summary |
void |
addFirst(Object anObject)
The addFirst: message adds a new member to the front of the list. |
void |
addLast(Object anObject)
The addLast: message adds a new member to the end of the list. |
Object |
removeFirst()
Removes the first member from the list and returns it. |
Object |
removeLast()
Removes the last member from the list and returns it. |
Methods inherited from interface swarm.defobj.Drop |
drop |
Methods inherited from interface swarm.defobj.DefinedObject |
compare,
describe,
describeID,
getDisplayName,
getTypeName,
getZone,
perform,
perform$with,
perform$with$with,
perform$with$with$with,
respondsTo,
setDisplayName,
xfprint,
xfprintid,
xprint,
xprintid |
addFirst
public void addFirst(Object anObject)
- The addFirst: message adds a new member to the front of the list.
addLast
public void addLast(Object anObject)
- The addLast: message adds a new member to the end of the list.
removeFirst
public Object removeFirst()
- Removes the first member from the list and returns it.
removeLast
public Object removeLast()
- Removes the last member from the list and returns it.