public final class NetworkNodeCollection extends AbstractList<Node>
Network.getNodes()
maintained by the Network
class. Duplicates and null values are not allowed.modCount
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Node item)
Inserts an element into the collection at the specified index.
|
void |
clear()
Removes all elements from the collection.
|
boolean |
contains(Object o)
Determines whether a
Node is in the collection. |
Node |
get(int index)
Gets the
Node object at the specified index. |
Node |
get(String name)
Performs a case sensitive lookup.
|
Node |
get(String name,
boolean throwIfNotFound)
Performs a case sensitive lookup.
|
Network |
getNetwork()
The
Network the collection belongs to. |
int |
indexOf(Object o)
Determines the index of a specific
Node in the collection. |
Node |
remove(int index)
Removes an element from the collection at the specified index, and any links that it has.
|
boolean |
remove(Node item)
Removes the
Node from the collection. |
Node |
set(int index,
Node value)
Sets the
Node object at the specified index. |
int |
size() |
add, addAll, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public Node get(int index)
Node
object at the specified index.get
in interface List<Node>
get
in class AbstractList<Node>
index
- The zero-based index of the Node
to find.Node
.NullPointerException
- Raised when value being set is null.IllegalStateException
- Raised if the value being set already belongs to a network.IllegalArgumentException
- index is less than 0.-or-index is equal to or greater than the collection count.public Node set(int index, Node value)
Node
object at the specified index.set
in interface List<Node>
set
in class AbstractList<Node>
index
- The zero-based index of the Node
to find.Node
.NullPointerException
- Raised when value being set is null.IllegalStateException
- Raised if the value being set already belongs to a network.IllegalArgumentException
- index is less than 0.-or-index is equal to or greater than the collection count.public boolean contains(Object o)
Node
is in the collection. The operation is O(1).contains
in interface Collection<Node>
contains
in interface List<Node>
contains
in class AbstractCollection<Node>
o
- The Node
to locate in the collection. The value can be null.public void clear()
clear
in interface Collection<Node>
clear
in interface List<Node>
clear
in class AbstractList<Node>
public void add(int index, Node item)
add
in interface List<Node>
add
in class AbstractList<Node>
index
- The zero based index at which to add the element.item
- The item to insert. Cannot be null.NullPointerException
- Raised when [item] is null.IllegalStateException
- Raised if the node already belongs to a network.IllegalArgumentException
- index is less than 0.-or-index is equal to or greater than the collection count.public int indexOf(Object o)
Node
in the collection. This operation is O(1).public boolean remove(Node item)
Node
from the collection.item
- The Node
to be removed from the collection.NullPointerException
- Raised if [item] is null.public Node remove(int index)
remove
in interface List<Node>
remove
in class AbstractList<Node>
index
- The zero based index at which to remove the element.IllegalArgumentException
- index is less than 0.-or-index is equal to or greater than the collection count.public int size()
size
in interface Collection<Node>
size
in interface List<Node>
size
in class AbstractCollection<Node>
Copyright © 2023. All rights reserved.