|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
groovy.lang.SpreadList
public class SpreadList
Spreads a list as individual objects to support the spread operator (*) for lists. For examples,
def fn(a, b, c, d) { return a + b + c + d }
println fn(1, 2, 3, 4)
def x = [10, 100]
def y = [1, *x, 1000, *[10000, 100000]]
assert y == [1, 10, 100, 1000, 10000, 100000]
| Field Summary |
|---|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
SpreadList(Object[] contents)
Generator. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object that)
Compares this with another object. |
boolean |
equals(SpreadList that)
Compares this with another spreadlist. |
Object |
get(int index)
Returns the object in this of the indicated position. |
int |
hashCode()
Returns the hash code of this. |
int |
size()
Returns the size of this. |
List |
subList(int fromIndex,
int toIndex)
Returns a sublist of this from fromIndex to toIndex. |
String |
toString()
Returns the string expression of this. |
| Methods inherited from class java.util.AbstractList |
|---|
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
|---|
public SpreadList(Object[] contents)
contents - an array of objects to be converted to a SpreadList| Method Detail |
|---|
public Object get(int index)
this of the indicated position.
get in interface Listget in class AbstractListindex - the indicated position in thispublic int size()
this.
size in interface Collectionsize in interface Listsize in class AbstractCollectionindex - the indicated position in thispublic boolean equals(Object that)
this with another object.
equals in interface Collectionequals in interface Listequals in class AbstractListthat - another object to be compared with this
true if this equals to that, false otherwisepublic boolean equals(SpreadList that)
this with another spreadlist.
that - another spreadlist to be compared with this
true if this equals to that, false otherwisepublic int hashCode()
this.
hashCode in interface CollectionhashCode in interface ListhashCode in class AbstractListthis
public List subList(int fromIndex,
int toIndex)
this from fromIndex to toIndex.
subList in interface ListsubList in class AbstractListfromIndex - the first index in this to be takentoIndex - the last index in this to be taken
thin in the given scopepublic String toString()
this.
toString in class AbstractCollectionthis
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||