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 voidadd(int index, String item)Inserts an element into the collection at the specified index.voidclear()Removes all elements from the collection.booleancontains(Object o)Determines whether a group name is in the collection.Stringget(int index)Gets the group at the specified index.NodegetNode()TheNodethe collection belongs to.intindexOf(Object o)Determines the index of a specific group in the collection.Stringremove(int index)Removes an element from the collection at the specified index.booleanremove(String item)Removes the group from the collection.Stringset(int index, String value)Sets the group at the specified index.intsize()Gets the number of elements contained in theNodeGroupCollectioninstance.-
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 theNodeGroupCollectioninstance.- Specified by:
sizein interfaceCollection<String>- Specified by:
sizein interfaceList<String>- Specified by:
sizein 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:
containsin interfaceCollection<String>- Specified by:
containsin interfaceList<String>- Overrides:
containsin 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:
addin interfaceList<String>- Overrides:
addin 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:
clearin interfaceCollection<String>- Specified by:
clearin interfaceList<String>- Overrides:
clearin 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:
removein interfaceList<String>- Overrides:
removein 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.
-
-