public class NodeList extends YList implements ICollection<Object>
Node
.EMPTY
Constructor and Description |
---|
NodeList()
Creates an empty node list.
|
NodeList(INodeCursor c)
Creates a list that is initialized with the nodes provided by the given NodeCursor object.
|
NodeList(INodeCursor nc,
IDataProvider predicate)
Creates a list that is initialized with those nodes from the given NodeCursor object for which the given data provider
returns
true upon calling its getBool method. |
NodeList(Node v)
Creates a list that is initialized with a single node provided.
|
NodeList(Node[] a)
Creates a list that is initialized with the nodes provided by the given array of nodes.
|
NodeList(NodeList list)
Creates a list that is initialized with the entries of the given list.
|
Modifier and Type | Method and Description |
---|---|
Node |
firstNode()
Returns the first node in this list, or
null when the list is empty. |
Node |
lastNode()
Returns the last node in this list, or
null when the list is empty. |
INodeCursor |
nodes()
Returns a node cursor for this node list.
|
Node |
popNode()
Removes the first node from this list and returns it.
|
Object[] |
toArray(Object[] a)
Returns an array containing all list elements in the correct order.
|
Node[] |
toNodeArray()
Returns a node array containing all elements of this list in the canonical order.
|
add, add, addAll, addAll, addAll, addFirst, addFirstCell, addLast, addLastCell, clear, contains, containsAll, copyTo, copyTo, cursor, cyclicPred, cyclicSucc, elementAt, enumerator, equals, findCell, first, firstCell, get, getCell, getInfo, hashCode, indexOf, insertAfter, insertBefore, insertCellAfter, insertCellBefore, isEmpty, last, lastCell, lastIndexOf, listIterator, parallelStream, peek, pop, popLast, predCell, push, remove, removeAll, removeAt, removeCell, retainAll, reverse, set, setInfo, size, sort, sort, splice, stream, subList, succCell, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, containsAll, isEmpty, iterator, parallelStream, remove, removeAll, retainAll, stream, toArray
concat, concat, create, create, enumerator
add, clear, contains, equals, hashCode, removeIf, size, spliterator
iterator, listIterator, remove, replaceAll, spliterator
public NodeList()
public NodeList(INodeCursor c)
public NodeList(INodeCursor nc, IDataProvider predicate)
true
upon calling its getBool
method.nc
- A node cursor providing nodes that should be added to this list.predicate
- A data provider that acts as a inclusion predicate for each node accessible by the given node cursor.public NodeList(Node v)
public NodeList(Node[] a)
public NodeList(NodeList list)
list
- the values are added to the new listpublic final Node firstNode()
null
when the list is empty.public final Node lastNode()
null
when the list is empty.public final INodeCursor nodes()
public final Node popNode()
public Object[] toArray(Object[] a)
YList
The runtime type of the returned array is that of the given array.
If the list does not fit in the specified array, a new array is allocated with the runtime type of the specified array and the size of this list.
If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the
element in the array immediately following the end of the collection is set to null
. This is useful in
determining the length of the list only if the caller knows that the list does not contain any null
elements.
toArray
in interface ICollection<Object>
toArray
in interface Collection<Object>
toArray
in interface List<Object>
toArray
in class YList
a
- The array into which the elements of the list are to be stored, if it is big enough. Otherwise, a new array of the same
runtime type is allocated for this purpose.public final Node[] toNodeArray()