SNamedList
int ro size
The number of Objects in the list
List<Object> asList()
Returns a List of Objects with the same contents as this one.
boolean contains(Object object)
Returns true if
object
is in this list.
Parameters:
void each(Closure block)
Executes the code in
block
on each Object in this list.
Parameters:
SList<Object> find(String pattern)
Returns a list of Objects whose names match a regular expression.
The given pattern is matched against the full name of each list element. This means, for example, that the pattern "foo" will match an element named "foo" but not one named "foobar", while the pattern "foo.*" will match both.
Parameters:
void forEach(Consumer<Object> action)
Performs the given action for each element of the
Iterable
until all elements have been processed or the action throws an exception. Unless otherwise specified by the implementing class, actions are performed in the order of iteration (if an iteration order is specified). Exceptions thrown by the action are relayed to the caller.
-
Implementation Requirements:
-
The default implementation behaves as if:
for (T t : this)
action.accept(t);
-
Parameters:
-
action
- The action to be performed for each element
-
Throws:
-
NullPointerException
- if the specified action is null
-
Since:
-
1.8
Object get(int index)
Returns the Object at index
index
.
Parameters:
SList<Object> get(Collection<Object> names)
Returns a list of Objects whose names are in the given collection.
Parameters:
int indexOf(Object object)
Returns the index of
object
in this list, or -1 if not found.
Parameters:
Iterator<Object> iterator()
Returns an iterator over the Objects in this list.
Spliterator<Object> spliterator()
Creates a
Spliterator
over the elements described by this
Iterable
.
-
Implementation Requirements:
-
The default implementation creates an
early-binding spliterator from the iterable's
Iterator
. The spliterator inherits the
fail-fast properties of the iterable's iterator.
-
Implementation Note:
-
The default implementation should usually be overridden. The spliterator returned by the default implementation has poor splitting capabilities, is unsized, and does not report any spliterator characteristics. Implementing classes can nearly always provide a better implementation.
-
Returns:
-
a
Spliterator
over the elements described by this
Iterable
.
-
Since:
-
1.8