java.lang.Object
de.powerstat.validation.containers.GroupOf<T>
- Type Parameters:
T
- Use only entities
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,Set<T>
Group of a specific type.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds the specified element to this set if it is not already present.boolean
addAll
(Collection<? extends T> c) Returns true if this set contains all of the elements of the specified collection.void
clear()
Removes all of the elements from this set (optional operation).boolean
Returns true if this set contains the specified element.boolean
containsAll
(Collection<?> c) Returns true if this set contains all of the elements of the specified collection.boolean
Is equal with another object.int
hashCode()
Calculate hash code.boolean
isEmpty()
Returns true if this set contains no elements.iterator()
Returns an iterator over the elements in this set.name()
Returns the name of this GroupOf.boolean
Removes the specified element from this set if it is present.boolean
removeAll
(Collection<?> c) Removes from this set all of its elements that are contained in the specified collection.boolean
retainAll
(Collection<?> c) Retains only the elements in this set that are contained in the specified collection.int
size()
Returns the number of elements in this set (its cardinality).Object[]
toArray()
Returns an array containing all of the elements in this set.<T> T[]
toArray
(T[] a) Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array.toString()
Returns the string representation of this GroupOf.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.Set
spliterator
-
Field Details
-
GROUPNAME_REGEXP
Group name regexp. -
name
Group name. -
group
Group.
-
-
Constructor Details
-
GroupOf
Constructor.- Parameters:
groupName
- Group name (maximum 40 characters)
-
-
Method Details
-
name
Returns the name of this GroupOf.- Returns:
- The name of this group.
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object.- Specified by:
equals
in interfaceCollection<T>
- Specified by:
equals
in interfaceSet<T>
- Overrides:
equals
in classObject
- Parameters:
obj
- Object- Returns:
- true when equal, false otherwise
- Throws:
NoSuchElementException
- If there is no entry in this GroupOf- See Also:
-
toString
Returns the string representation of this GroupOf. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "GroupOf<>[, ...]" -
size
public int size()Returns the number of elements in this set (its cardinality). -
isEmpty
public boolean isEmpty()Returns true if this set contains no elements. -
contains
Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that (o==null ? e==null : o.equals(e)). -
iterator
Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee). -
toArray
Returns an array containing all of the elements in this set. If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. -
toArray
public <T> T[] toArray(T[] a) Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. If the set fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this set.- Specified by:
toArray
in interfaceCollection<T>
- Specified by:
toArray
in interfaceSet<T>
- Parameters:
a
- The array into which the elements of this set are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.- Returns:
- An array containing all the elements in this set
-
add
Adds the specified element to this set if it is not already present. -
remove
Removes the specified element from this set if it is present. -
containsAll
Returns true if this set contains all of the elements of the specified collection. If the specified collection is also a set, this method returns true if it is a subset of this set.- Specified by:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceSet<T>
- Parameters:
c
- Collection to be checked for containment in this set- Returns:
- true if this set contains all of the elements of the specified collection
-
addAll
Returns true if this set contains all of the elements of the specified collection. If the specified collection is also a set, this method returns true if it is a subset of this set. -
retainAll
Retains only the elements in this set that are contained in the specified collection. -
removeAll
Removes from this set all of its elements that are contained in the specified collection. -
clear
public void clear()Removes all of the elements from this set (optional operation). The set will be empty after this call returns.
-