Return type | Name and parameters |
---|---|
SortedSet
|
and(Iterable right)
Creates a SortedSet composed of the intersection of a SortedSet and an Iterable. |
SortedSet
|
and(Iterable right, Comparator comparator)
Creates a SortedSet composed of the intersection of a SortedSet and an Iterable. |
SortedSet
|
asChecked(Class type)
Creates a checked view of a SortedSet. |
SortedSet
|
asImmutable()
A convenience method for creating an immutable SortedSet. |
SortedSet
|
asSynchronized()
Creates a synchronized view of a SortedSet. |
SortedSet
|
asUnmodifiable()
Creates an unmodifiable view of a 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 a SortedSet, passing each item to the given closure. |
SortedSet
|
eachWithIndex(Closure closure)
Iterates through a 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
|
intersect(Iterable right, Comparator comparator)
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
|
or(Iterable right)
Create a SortedSet as a union of a SortedSet and an Iterable. |
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 a 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 |
SortedSet
|
union(Iterable right)
Create a SortedSet composed of the union of a SortedSet and an Iterable. |
SortedSet
|
union(Iterable right, Comparator comparator)
Create a SortedSet composed of the intersection of a SortedSet and an Iterable. |
SortedSet
|
xor(Iterable right)
Create a SortedSet composed of the symmetric difference of a SortedSet and an Iterable. |
SortedSet
|
xor(Iterable right, Comparator comparator)
Create a SortedSet composed of the symmetric difference of a SortedSet and an Iterable. |
and
, and
, asChecked
, asImmutable
, asSynchronized
, asUnmodifiable
, each
, eachWithIndex
, equals
, findAll
, findAll
, flatten
, grep
, grep
, intersect
, intersect
, leftShift
, minus
, minus
, minus
, or
, plus
, plus
, plus
, split
, union
, union
, xor
, xor
addAll
, addAll
, addAll
, asBoolean
, asChecked
, asImmutable
, asSynchronized
, asType
, asUnmodifiable
, collectNested
, each
, eachWithIndex
, find
, find
, findAll
, findAll
, flatten
, getAt
, getIndices
, grep
, grep
, intersect
, intersect
, isCase
, isNotCase
, leftShift
, minus
, plus
, plus
, plus
, removeAll
, removeAll
, removeElement
, retainAll
, retainAll
, split
, toListString
, toListString
, toSet
, union
, union
, unique
, unique
, unique
, unique
, unique
, unique
any
, asCollection
, asList
, asType
, average
, average
, bufferedIterator
, chop
, collate
, collate
, collate
, collate
, collect
, collect
, collect
, collectEntries
, collectEntries
, collectEntries
, collectEntries
, collectEntries
, collectEntries
, collectMany
, collectMany
, collectNested
, collectNested
, combinations
, combinations
, contains
, containsAll
, count
, count
, count
, countBy
, countBy
, disjoint
, drop
, dropRight
, dropWhile
, each
, eachCombination
, eachPermutation
, eachWithIndex
, every
, findIndexOf
, findIndexOf
, findIndexValues
, findIndexValues
, findLastIndexOf
, findLastIndexOf
, findResult
, findResult
, findResult
, findResult
, findResults
, findResults
, first
, flatten
, flatten
, flatten
, flatten
, flattenMany
, getAt
, groupBy
, groupBy
, groupBy
, head
, indexed
, indexed
, init
, inits
, inject
, inject
, intersect
, intersect
, intersect
, isCase
, isEmpty
, join
, join
, last
, max
, max
, max
, min
, min
, min
, minus
, minus
, minus
, minus
, multiply
, permutations
, permutations
, plus
, plus
, size
, sort
, sort
, sort
, sort
, sort
, stream
, sum
, sum
, sum
, sum
, tail
, tails
, take
, takeRight
, takeWhile
, toList
, toSet
, toSorted
, toSorted
, toSorted
, toSpreadMap
, toUnique
, toUnique
, toUnique
, union
, union
, union
, withCollectedKeys
, withCollectedKeys
, withCollectedValues
, withCollectedValues
, withIndex
, withIndex
, zip
Creates a SortedSet composed of the intersection of a SortedSet and an Iterable. Any elements that exist in both are added to the resultant SortedSet.
This operation will always create a new object for the result, while the operands remain unchanged.
def a = [1,2,3,4] as SortedSet def b = [3,4,5,6] as Set assert (a & b) == [3,4] as SortedSetBy default, Groovy uses a NumberAwareComparator when determining if an element exists in both sets.
right
- an IterableCreates 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.
This operation will always create a new object for the result, while the operands remain unchanged.
assert [3,4] as SortedSet == ([1,2,3,4] as SortedSet).and([3,4,5,6], Comparator.naturalOrder())
right
- an Iterablecomparator
- a ComparatorCreates a checked view of a SortedSet.
A convenience method for creating an immutable SortedSet.
Creates a synchronized view of a SortedSet.
Creates an unmodifiable view of a 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 than 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 than 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 a SortedSet, passing each item to the given closure.
closure
- the closure applied on each element foundIterates through a 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.
Set nested = [[0,1],[2],3,[4],5] SortedSet sorted = new TreeSet({ a, b->
(a instanceof List ? a[0] : a)<=>
(b instanceof List ? b[0] : b) } as Comparator) sorted.addAll(nested) assert [0,1,2,3,4,5] as SortedSet == sorted.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() == [2, 3] 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])By default, Groovy uses a NumberAwareComparator when determining if an element exists in both collections.
right
- an IterableCreate 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 Iterablecomparator
- a ComparatorOverloads 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. Any elements that exist in either are added to the resultant SortedSet.
This operation will always create a new object for the result, while the operands remain unchanged.
def a = [1,2,3,4] as SortedSet def b = [3,4,5,6] as Set assert (a | b) == [1,2,3,4,5,6] as SortedSet
right
- the right IterableCreate 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 a 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 than 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 than 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
Create a SortedSet composed of the union of a SortedSet and an Iterable. Any elements that exist in either iterables are added to the resultant collection, such that no elements are duplicated in the resultant collection.
assert [1,2,3,4,5,6,7,8] as SortedSet == ([1,2,3,4,5] as SortedSet).union([4,5,6,7,8])By default, Groovy uses a NumberAwareComparator when determining if an element already exists in the resultant collection.
right
- an IterableCreate a SortedSet composed of the intersection of a SortedSet and an Iterable. Any elements that exist in either iterables are added to the resultant collection, such that no elements are duplicated in the resultant collection.
assert [1,2,3,4,5,6,7,8] as SortedSet == ([1,2,3,4,5] as SortedSet).union([4,5,6,7,8])
right
- an Iterablecomparator
- a ComparatorCreate a SortedSet composed of the symmetric difference of a SortedSet and an Iterable. Any elements that exist in only one of the sets are added to the resultant SortedSet.
This operation will always create a new object for the result, while the operands remain unchanged.
def a = [1,2,3,4] as SortedSet def b = [3,4,5,6] as Set assert (a ^ b) == [1,2,5,6] as SortedSetBy default, Groovy uses a NumberAwareComparator when determining if an element exists in both sets.
right
- an IterableCreate a SortedSet composed of the symmetric difference of a SortedSet and an Iterable. Any elements that exit in only one are added to the resultant SortedSet.
This operation will always create a new object for the result, while the operands remain unchanged.
assert [1,2,5,6] as SortedSet == ([1,2,3,4] as SortedSet).xor([3,4,5,6], Comparator.naturalOrder())
right
- an Iterablecomparator
- a Comparator