Package groovy.lang
Class NonEmptySequence
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList
groovy.lang.Sequence
groovy.lang.NonEmptySequence
- All Implemented Interfaces:
GroovyObject,Serializable,Cloneable,Iterable,Collection,List,RandomAccess
Represents a sequence of one or more objects of a given type.
The type can be omitted in which case any type of object can be added.
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionCreates a non-empty sequence with no type restriction.NonEmptySequence(Class type) Creates a non-empty sequence constrained to the supplied type.NonEmptySequence(Class type, List content) Creates a non-empty sequence initialized with the supplied content. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the minimum allowed size for this sequence.Methods inherited from class groovy.lang.Sequence
add, add, addAll, addAll, checkCollectionType, checkType, clear, equals, equals, getMetaClass, getProperty, hashCode, invokeMethod, remove, removeRange, set, set, setMetaClass, setProperty, typeMethods inherited from class java.util.ArrayList
clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, removeIf, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Constructor Details
-
NonEmptySequence
public NonEmptySequence()Creates a non-empty sequence with no type restriction. -
NonEmptySequence
Creates a non-empty sequence constrained to the supplied type.- Parameters:
type- the allowed element type
-
NonEmptySequence
Creates a non-empty sequence initialized with the supplied content.- Parameters:
type- the allowed element typecontent- the initial content
-
-
Method Details
-
minimumSize
public int minimumSize()Returns the minimum allowed size for this sequence.- Overrides:
minimumSizein classSequence- Returns:
- the minimum size
-