public class ListWithDefault
extends Object
GDK enhancements for ListWithDefault.
| Type Params | Return Type | Name and description |
|---|---|---|
<T> |
public List<T> |
getAt(Collection indices)Select a List of items from an eager or lazy List using a Collection to identify the indices to be selected. |
<T> |
public List<T> |
getAt(Range range)Support the range subscript operator for an eager or lazy List. |
<T> |
public List<T> |
getAt(EmptyRange range)Support the range subscript operator for an eager or lazy List. |
| Methods inherited from class | Name |
|---|---|
class Object |
addShutdownHook, any, any, asBoolean, asType, collect, collect, collect, dump, each, eachMatch, eachMatch, eachWithIndex, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, findResult, findResult, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, hasProperty, identity, inject, inject, inspect, invokeMethod, is, isCase, isNotCase, iterator, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, sleep, sleep, split, sprintf, sprintf, stream, tap, toString, use, use, use, with, with, withCloseable, withCloseable, withMethodClosure, withStream, withStream, withTraits |
Select a List of items from an eager or lazy List using a Collection to identify the indices to be selected.
def list = [].withDefault { 42 }
assert list[1,0,2] == [42, 42, 42]
indices - a Collection of indicesSupport the range subscript operator for an eager or lazy List.
def list = [].withDefault { 42 }
assert list[1..2] == [null, 42]
range - a Range indicating the items to getSupport the range subscript operator for an eager or lazy List.
def list = [true, 1, 3.4].withDefault{ 42 }
assert list[0..<0] == []
range - a Range indicating the items to get