|
Groovy JDK |
Method Summary | |
---|---|
List
|
asImmutable()
A convenience method for creating an immutable list |
List
|
asSynchronized()
A convenience method for creating a synchronized List. |
boolean
|
equals(Object[] right)
Determines if the contents of this list are equal to the contents of the given array in the same order. |
boolean
|
equals(List right)
Compare the contents of two Lists. |
Process
|
execute()
Executes the command specified by the String list that is the parameter.
|
T
|
first()
Returns the first item from the List. |
List
|
getAt(Range range)
Support the range subscript operator for a List |
List
|
getAt(EmptyRange range)
Support the range subscript operator for a List |
List
|
getAt(Collection indices)
Select a List of items from a List using a Collection to identify the indices to be selected. |
T
|
getAt(int idx)
Support the subscript operator for a List. |
T
|
head()
Returns the first item from the List. |
T
|
last()
Returns the last item from the List. |
List
|
minus(Collection removeMe)
Create a List composed of the elements of the first list minus the elements of the given collection. |
List
|
minus(Object operand)
Create a new List composed of the elements of the first list minus the operand. |
Set
|
permutations()
Finds all permutations of a collection. |
T
|
pop()
Removes the last item from the List. |
boolean
|
push(T value)
Appends an item to the List. |
void
|
putAt(int idx, T value)
A helper method to allow lists to work with subscript operators. |
void
|
putAt(EmptyRange range, Object value)
A helper method to allow lists to work with subscript operators. |
void
|
putAt(EmptyRange range, Collection value)
A helper method to allow lists to work with subscript operators. |
void
|
putAt(IntRange range, Collection col)
List subscript assignment operator when given a range as the index and the assignment operand is a collection. |
void
|
putAt(IntRange range, Object value)
List subscript assignment operator when given a range as the index. |
void
|
putAt(List splice, List values)
A helper method to allow lists to work with subscript operators. |
void
|
putAt(List splice, Object value)
A helper method to allow lists to work with subscript operators. |
List
|
reverse()
Reverses the list. |
List
|
reverseEach(Closure closure)
Iterate over each element of the list in the reverse order. |
Set
|
subsequences()
Finds all non-null subsequences of a list. |
List
|
tail()
Returns the items from the List excluding the first item. |
List
|
transpose()
Adds GroovyCollections#transpose(List) as a method on lists. |
Method Detail |
---|
public List asImmutable()
public List asSynchronized()
public boolean equals(Object[] right)
false
if either collection is null
.right
- this Object[] being compared to.public boolean equals(List right)
null
, the result
is false
.right
- the List being compared to..true
if the contents of both lists are identical,
false
otherwise.public Process execute()
String
list that is the parameter.
The first item in the array is the command the others are the parameters. All entries
must be String
s. For more control over the process mechanism in JDK 1.5 you
can use java.lang.ProcessBuilder
.public T first()
public List getAt(Range range)
range
- a Range indicating the items to get.public List getAt(EmptyRange range)
range
- a Range indicating the items to get.public List getAt(Collection indices)
indices
- a Collection of indices.public T getAt(int idx)
idx
- an index.public T head()
public T last()
public List minus(Collection removeMe)
removeMe
- a Collection of elements to remove.public List minus(Object operand)
operand
- an element to remove from the list.public Set permutations()
[1, 2, 3].permutations()
would be:
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]public T pop()
public boolean push(T value)
value
- element to be appended to this list..public void putAt(int idx, T value)
idx
- an index.value
- the value to put at the given index.public void putAt(EmptyRange range, Object value)
range
- the (in this case empty) subset of the list to set.value
- the values to put at the given sublist or a Collection of values.public void putAt(EmptyRange range, Collection value)
range
- the (in this case empty) subset of the list to set.value
- the Collection of values.public void putAt(IntRange range, Collection col)
myList[3..5] = anotherList
. Items in the given
range are relaced with items from the collection.range
- the subset of the list to set.col
- the collection of values to put at the given sublist.public void putAt(IntRange range, Object value)
myList[3..5] = newItem
. Items in the given
range are relaced with the operand. The value
operand is
always treated as a single value.range
- the subset of the list to set.value
- the value to put at the given sublist.public void putAt(List splice, List values)
splice
- the subset of the list to set.values
- the value to put at the given sublist.public void putAt(List splice, Object value)
splice
- the subset of the list to set.value
- the value to put at the given sublist.public List reverse()
public List reverseEach(Closure closure)
closure
- a closure to which each item is passed..public Set subsequences()
[1, 2, 3].subsequences()
would be:
[[1, 2, 3], [1, 3], [2, 3], [1, 2], [1], [2], [3]]public List tail()
public List transpose()
|
Groovy JDK |