Package com.bayesserver
Class NodeGroupCollection
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<String>
-
- com.bayesserver.NodeGroupCollection
-
public final class NodeGroupCollection extends AbstractList<String>
Represents the collection of groups a node belongs to.
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, String 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 group name is in the collection.String
get(int index)
Gets the group at the specified index.Node
getNode()
TheNode
the collection belongs to.int
indexOf(Object o)
Determines the index of a specific group in the collection.String
remove(int index)
Removes an element from the collection at the specified index.boolean
remove(String item)
Removes the group from the collection.String
set(int index, String value)
Sets the group at the specified index.int
size()
Gets the number of elements contained in theNodeGroupCollection
instance.-
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
size
public int size()
Gets the number of elements contained in theNodeGroupCollection
instance.- Specified by:
size
in interfaceCollection<String>
- Specified by:
size
in interfaceList<String>
- Specified by:
size
in classAbstractCollection<String>
-
indexOf
public int indexOf(Object o)
Determines the index of a specific group in the collection.
-
contains
public boolean contains(Object o)
Determines whether a group name is in the collection.- Specified by:
contains
in interfaceCollection<String>
- Specified by:
contains
in interfaceList<String>
- Overrides:
contains
in classAbstractCollection<String>
- Parameters:
o
- The group name to locate in the collection. The value can be null.- Returns:
- true if [o] is found in the collection; otherwise, false.
-
add
public void add(int index, String item)
Inserts an element into the collection at the specified index.- Specified by:
add
in interfaceList<String>
- Overrides:
add
in classAbstractList<String>
- Parameters:
index
- The zero based index at which to add the element.item
- The item to insert. Cannot be null.- Throws:
NullPointerException
- Raised if [item] is null.IllegalArgumentException
- index is less than 0.-or-index is equal to or greater than the collection count.
-
clear
public void clear()
Removes all elements from the collection.- Specified by:
clear
in interfaceCollection<String>
- Specified by:
clear
in interfaceList<String>
- Overrides:
clear
in classAbstractList<String>
-
remove
public boolean remove(String item)
Removes the group from the collection.- Parameters:
item
- The group to be removed from the collection.- Returns:
- true if item was successfully removed from the collection; otherwise, false. This method also returns false if item is not found in the collection.
- Throws:
NullPointerException
- Raised if [item] is null.
-
remove
public String remove(int index)
Removes an element from the collection at the specified index.- Specified by:
remove
in interfaceList<String>
- Overrides:
remove
in classAbstractList<String>
- Parameters:
index
- The zero based index at which to remove the element.- Throws:
IllegalArgumentException
- index is less than 0.-or-index is equal to or greater than the collection count.
-
get
public String get(int index)
Gets the group at the specified index.
-
-