Return type | Name and parameters |
---|---|
SortedSet
|
asImmutable()
A convenience method for creating an immutable sorted set. |
SortedSet
|
asSynchronized()
A convenience method for creating a synchronized SortedSet. |
SortedSet
|
drop(int num)
Drops the given number of elements from the head of this List. |
SortedSet
|
dropRight(int num)
Drops the given number of elements from the tail of this SortedSet. |
SortedSet
|
dropWhile(Closure condition)
Returns a suffix of this SortedSet where elements are dropped from the front while the given Closure evaluates to true. |
SortedSet
|
each(Closure closure)
Iterates through an SortedSet, passing each item to the given closure. |
SortedSet
|
eachWithIndex(Closure closure)
Iterates through an SortedSet, passing each item and the item's index (a counter starting at zero) to the given closure. |
SortedSet
|
flatten()
Flatten a SortedSet. |
SortedSet
|
init()
Returns the items from the SortedSet excluding the last item. |
SortedSet
|
intersect(Iterable right)
Create a SortedSet composed of the intersection of a SortedSet and an Iterable. |
SortedSet
|
leftShift(Object value)
Overloads the left shift operator to provide an easy way to append objects to a SortedSet. |
SortedSet
|
minus(Iterable removeMe)
Create a SortedSet composed of the elements of the first SortedSet minus the elements of the given Iterable. |
SortedSet
|
minus(Object removeMe)
Create a SortedSet composed of the elements of the first SortedSet minus the given element. |
SortedSet
|
minus(Collection removeMe)
Create a SortedSet composed of the elements of the first SortedSet minus the elements of the given Collection. |
SortedSet
|
plus(Iterable right)
Create a SortedSet as a union of a SortedSet and an Iterable. |
SortedSet
|
plus(Object right)
Create a SortedSet as a union of a SortedSet and an Object. |
SortedSet
|
plus(Collection right)
Create a SortedSet as a union of a SortedSet and an Collection. |
SortedSet
|
sort()
Avoids doing unnecessary work when sorting an already sorted set (i.e. an identity function for an already sorted set). |
SortedSet
|
tail()
Returns the items from the SortedSet excluding the first item. |
SortedSet
|
take(int num)
Returns the first num elements from the head of this SortedSet.
|
SortedSet
|
takeRight(int num)
Returns the last num elements from the tail of this SortedSet.
|
SortedSet
|
takeWhile(Closure condition)
Returns the longest prefix of this SortedSet where each element passed to the given closure condition evaluates to true. |
Set
|
toSorted()
Avoids doing unnecessary work when sorting an already sorted set |
asImmutable
, asSynchronized
, each
, eachWithIndex
, equals
, findAll
, findAll
, flatten
, grep
, grep
, intersect
, leftShift
, minus
, minus
, minus
, plus
, plus
, plus
, split
addAll
, addAll
, addAll
, asBoolean
, asImmutable
, asSynchronized
, asType
, collect
, collect
, collect
, collectNested
, each
, eachWithIndex
, find
, find
, findAll
, findAll
, findResult
, findResult
, flatten
, getAt
, getIndices
, grep
, grep
, inject
, inject
, intersect
, isCase
, leftShift
, minus
, plus
, plus
, plus
, removeAll
, removeAll
, removeElement
, retainAll
, retainAll
, split
, toListString
, toListString
, toSet
, unique
, unique
, unique
, unique
, unique
, unique
any
, asCollection
, asList
, collate
, collate
, collate
, collate
, collectEntries
, collectEntries
, collectEntries
, collectEntries
, collectMany
, collectMany
, collectNested
, collectNested
, combinations
, combinations
, contains
, containsAll
, count
, count
, countBy
, disjoint
, drop
, dropRight
, dropWhile
, each
, eachCombination
, eachPermutation
, eachWithIndex
, every
, findResults
, first
, flatten
, flatten
, getAt
, groupBy
, groupBy
, groupBy
, head
, indexed
, indexed
, init
, intersect
, join
, last
, max
, max
, max
, min
, min
, min
, minus
, minus
, multiply
, permutations
, permutations
, plus
, plus
, size
, sort
, sort
, sort
, sort
, sort
, sum
, sum
, sum
, sum
, tail
, take
, takeRight
, takeWhile
, toList
, toSet
, toSorted
, toSorted
, toSorted
, toSpreadMap
, toUnique
, toUnique
, toUnique
, withIndex
, withIndex
A convenience method for creating an immutable sorted set.
A convenience method for creating a synchronized SortedSet.
Drops the given number of elements from the head of this List.
def strings = [ 'a', 'b', 'c' ] as SortedSet assert strings.drop( 0 ) == [ 'a', 'b', 'c' ] as SortedSet assert strings.drop( 2 ) == [ 'c' ] as SortedSet assert strings.drop( 5 ) == [] as SortedSet
num
- the number of elements to drop from this Iterablenum
elements,
or an empty list if it has less then num
elements.Drops the given number of elements from the tail of this SortedSet.
def strings = [ 'a', 'b', 'c' ] as SortedSet assert strings.dropRight( 0 ) == [ 'a', 'b', 'c' ] as SortedSet assert strings.dropRight( 2 ) == [ 'a' ] as SortedSet assert strings.dropRight( 5 ) == [] as SortedSet
num
- the number of elements to drop from this SortedSetnum
elements,
or an empty SortedSet if it has less then num
elements.Returns a suffix of this SortedSet where elements are dropped from the front while the given Closure evaluates to true. Similar to Iterable#dropWhile(groovy.lang.Closure) except that it attempts to preserve the type of the original SortedSet.
def nums = [ 1, 2, 3 ] as SortedSet assert nums.dropWhile{ it < 4 } == [] as SortedSet assert nums.dropWhile{ it < 2 } == [ 2, 3 ] as SortedSet assert nums.dropWhile{ it != 3 } == [ 3 ] as SortedSet assert nums.dropWhile{ it == 0 } == [ 1, 2, 3 ] as SortedSet
condition
- the closure that must evaluate to true to continue dropping elementsIterates through an SortedSet, passing each item to the given closure.
closure
- the closure applied on each element foundIterates through an SortedSet, passing each item and the item's index (a counter starting at zero) to the given closure.
closure
- a Closure to operate on each itemFlatten a SortedSet. This SortedSet and any nested arrays or collections have their contents (recursively) added to the new SortedSet.
assert [1,2,3,4,5] as SortedSet == ([1,[2,3],[[4]],[],5] as SortedSet).flatten()
Returns the items from the SortedSet excluding the last item. Leaves the original SortedSet unchanged.
def sortedSet = [3, 4, 2] as SortedSet assert sortedSet.init() == [3, 4] as SortedSet assert sortedSet == [3, 4, 2] as SortedSet
Create a SortedSet composed of the intersection of a SortedSet and an Iterable. Any elements that exist in both iterables are added to the resultant collection.
assert [4,5] as SortedSet == ([1,2,3,4,5] as SortedSet).intersect([4,5,6,7,8])
right
- an IterableOverloads the left shift operator to provide an easy way to append objects to a SortedSet.
def set = [1,2] as SortedSet set << 3 assert set == [1,2,3] as SortedSet
value
- an Object to be added to the SortedSet.Create a SortedSet composed of the elements of the first SortedSet minus the elements of the given Iterable.
removeMe
- the items to remove from the SortedSetCreate a SortedSet composed of the elements of the first SortedSet minus the given element.
removeMe
- the element to remove from the SortedSetCreate a SortedSet composed of the elements of the first SortedSet minus the elements of the given Collection.
removeMe
- the items to remove from the SortedSetCreate a SortedSet as a union of a SortedSet and an Iterable. This operation will always create a new object for the result, while the operands remain unchanged.
right
- the right IterableCreate a SortedSet as a union of a SortedSet and an Object. This operation will always create a new object for the result, while the operands remain unchanged.
assert [1,2,3] == [1,2] + 3
right
- an object to add/appendCreate a SortedSet as a union of a SortedSet and an Collection. This operation will always create a new object for the result, while the operands remain unchanged.
right
- the right CollectionAvoids doing unnecessary work when sorting an already sorted set (i.e. an identity function for an already sorted set).
Returns the items from the SortedSet excluding the first item.
def sortedSet = [3, 4, 2] as SortedSet assert sortedSet.tail() == [3, 4] as SortedSet assert sortedSet == [3, 4, 2] as SortedSet
Returns the first num
elements from the head of this SortedSet.
def strings = [ 'a', 'b', 'c' ] as SortedSet assert strings.take( 0 ) == [] as SortedSet assert strings.take( 2 ) == [ 'a', 'b' ] as SortedSet assert strings.take( 5 ) == [ 'a', 'b', 'c' ] as SortedSet
num
- the number of elements to take from this SortedSetnum
elements from this List,
or else all the elements from the SortedSet if it has less then num
elements.Returns the last num
elements from the tail of this SortedSet.
def strings = [ 'a', 'b', 'c' ] as SortedSet assert strings.takeRight( 0 ) == [] as SortedSet assert strings.takeRight( 2 ) == [ 'b', 'c' ] as SortedSet assert strings.takeRight( 5 ) == [ 'a', 'b', 'c' ] as SortedSet
num
- the number of elements to take from this SortedSetnum
elements from this SortedSet,
or else all the elements from the SortedSet if it has less then num
elements.Returns the longest prefix of this SortedSet where each element passed to the given closure condition evaluates to true. Similar to Iterable#takeWhile(groovy.lang.Closure) except that it attempts to preserve the type of the original SortedSet.
def nums = [ 1, 2, 3 ] as SortedSet assert nums.takeWhile{ it < 1 } == [] as SortedSet assert nums.takeWhile{ it < 2 } == [ 1 ] as SortedSet assert nums.takeWhile{ it < 4 } == [ 1, 2, 3 ] as SortedSet
condition
- the closure that must evaluate to true to
continue taking elementsAvoids doing unnecessary work when sorting an already sorted set