E
- the type of the elementspublic abstract class RubyEnumerable<E> extends java.lang.Object implements Ruby.Enumerable<E>
RubyEnumerable
is an extension for any Iterable class. It includes
all methods refer to the Enumerable module of Ruby.
RubyEnumerable
is also a Ruby.Enumerable
.
Constructor and Description |
---|
RubyEnumerable() |
Modifier and Type | Method and Description |
---|---|
boolean |
allʔ()
Checks if null is excluded.
|
boolean |
allʔ(BooleanBlock<? super E> block)
Checks if any result returned by the block is false.
|
boolean |
anyʔ()
Checks if any non-null object is included.
|
boolean |
anyʔ(BooleanBlock<? super E> block)
Checks if any result returned by the block is true.
|
<S> RubyEnumerator<java.util.Map.Entry<S,RubyArray<E>>> |
chunk(java.lang.String methodName,
java.lang.Object... args)
Chunks elements into entries.
|
<S> RubyEnumerator<java.util.Map.Entry<S,RubyArray<E>>> |
chunk(TransformBlock<? super E,? extends S> block)
Chunks elements into entries.
|
RubyEnumerator<E> |
collect()
Returns an enumerator of elements.
|
<S> RubyArray<S> |
collect(java.lang.String methodName,
java.lang.Object... args)
Transforms each element by given method.
|
<S> RubyArray<S> |
collect(TransformBlock<? super E,? extends S> block)
Transforms each element by the block.
|
RubyEnumerator<E> |
collectConcat()
Returns an enumerator of elements.
|
<S> RubyArray<S> |
collectConcat(TransformBlock<? super E,? extends java.util.List<? extends S>> block)
Turns each element into a List and then flattens it.
|
int |
count()
Counts the elements.
|
int |
count(BooleanBlock<? super E> block)
Counts the elements which are true returned by the block.
|
RubyEnumerator<E> |
cycle()
Generates a sequence from first element to last element and so on
infinitely.
|
void |
cycle(Block<? super E> block)
Generates a sequence from start element to end element and so on
infinitely.
|
RubyEnumerator<E> |
cycle(int n)
Generates a sequence from first element to last element, repeat n times.
|
void |
cycle(int n,
Block<? super E> block)
Generates a sequence from start element to end element, repeat n times.
|
RubyEnumerator<E> |
detect()
Returns an enumerator of elements.
|
E |
detect(BooleanBlock<? super E> block)
Finds the first element which gets true returned by the block.
|
RubyArray<E> |
drop(int n)
Drops the first n elements.
|
RubyEnumerator<E> |
dropWhile()
Returns an enumerator which contains only the first element.
|
RubyArray<E> |
dropWhile(BooleanBlock<? super E> block)
Drops the first n elements until an element gets false returned by the
block.
|
RubyEnumerator<E> |
each()
Returns an enumerator of elements.
|
RubyEnumerable<E> |
each(Block<? super E> block)
Yields each element to the block.
|
RubyEnumerator<RubyArray<E>> |
eachCons(int n)
Iterates each element and puts the element with n - 1 consecutive
elements into a
RubyArray . |
void |
eachCons(int n,
Block<? super RubyArray<E>> block)
Iterates each element and yields the element with n - 1 consecutive
elements to the block.
|
RubyEnumerator<E> |
eachEntry()
Returns an enumerator of elements.
|
RubyEnumerable<E> |
eachEntry(Block<? super E> block)
Yields each element to the block.
|
RubyEnumerator<RubyArray<E>> |
eachSlice(int n)
Slices elements into
RubyArray s with length n. |
void |
eachSlice(int n,
Block<? super RubyArray<E>> block)
Slices elements into
RubyArray s with length n and yield them to
the block. |
RubyEnumerator<java.util.Map.Entry<E,java.lang.Integer>> |
eachWithIndex()
Iterates elements with their indices by Entry.
|
RubyEnumerable<E> |
eachWithIndex(WithIndexBlock<? super E> block)
Iterates elements with their indices and yields them to the block.
|
<O> RubyEnumerator<java.util.Map.Entry<E,O>> |
eachWithObject(O obj)
Iterates elements with an object O.
|
<O> O |
eachWithObject(O obj,
WithObjectBlock<? super E,? super O> block)
Iterates elements with an object O and yield them to the block.
|
RubyArray<E> |
entries()
Puts each element into a
RubyArray . |
RubyEnumerator<E> |
find()
Equivalent to
RubyContract.Enumerable.detect() . |
E |
find(BooleanBlock<? super E> block)
Equivalent to
RubyContract.Enumerable.detect(BooleanBlock) . |
RubyEnumerator<E> |
findAll()
Returns an enumerator of elements.
|
RubyArray<E> |
findAll(BooleanBlock<? super E> block)
Finds all elements which are true returned by the block.
|
RubyEnumerator<E> |
findIndex()
Returns an enumerator of elements.
|
java.lang.Integer |
findIndex(BooleanBlock<? super E> block)
Returns the index of first element which gets true returned by the block.
|
java.lang.Integer |
findIndex(E target)
Returns the index of the target element.
|
E |
first()
Returns first element.
|
RubyArray<E> |
first(int n)
Returns the first n elements.
|
RubyEnumerator<E> |
flatMap()
Equivalent to
RubyContract.Enumerable.collectConcat() . |
<S> RubyArray<S> |
flatMap(TransformBlock<? super E,? extends java.util.List<? extends S>> block)
Equivalent to
RubyContract.Enumerable.collectConcat(TransformBlock) . |
protected abstract java.lang.Iterable<E> |
getIterable()
Returns an Iterable of elements.
|
RubyArray<E> |
grep(java.lang.String regex)
Finds all elements which are matched by the regular expression.
|
<S> RubyArray<S> |
grep(java.lang.String regex,
java.lang.String methodName,
java.lang.Object... args)
Finds all elements which are matched by the regular expression and
invokes them by given method name.
|
<S> RubyArray<S> |
grep(java.lang.String regex,
TransformBlock<? super E,? extends S> block)
Finds all elements which are matched by the regular expression and
transforms them.
|
RubyEnumerator<E> |
groupBy()
Returns an enumerator of elements.
|
<S> RubyHash<S,RubyArray<E>> |
groupBy(java.lang.String methodName,
java.lang.Object... args)
Puts elements with the same result S invoked by given method name into a
Entry<S, RubyArray<E>>y of a
RubyHash . |
<S> RubyHash<S,RubyArray<E>> |
groupBy(TransformBlock<? super E,? extends S> block)
Puts elements with the same result S returned by the block into a
Entry<S, RubyArray<E>>y of a
RubyHash . |
boolean |
includeʔ(E target)
Checks if target element is included.
|
<I> I |
inject(I init,
java.lang.String methodName)
Reduces each element with initial value by a method of S, then assigns
the result back to initial value and so on.
|
<I> I |
inject(I init,
WithInitBlock<? super E,I> block)
Reduces each element with block, then assigns the result back to initial
value and so on.
|
E |
inject(ReduceBlock<E> block)
Assigns the first element as the initial value.
|
E |
inject(java.lang.String methodName)
Assigns the first element as the initial value.
|
java.util.Iterator<E> |
iterator() |
RubyLazyEnumerator<E> |
lazy()
Returns a
RubyLazyEnumerator . |
RubyEnumerator<E> |
map()
Returns an enumerator of elements.
|
<S> RubyArray<S> |
map(java.lang.String methodName,
java.lang.Object... args)
Equivalent to
RubyContract.Enumerable.collect(String, Object...) . |
<S> RubyArray<S> |
map(TransformBlock<? super E,? extends S> block)
Equivalent to
RubyContract.Enumerable.collect(TransformBlock) . |
E |
max()
Finds the max element.
|
E |
max(java.util.Comparator<? super E> comp)
Finds the max element compared by the Comparator.
|
RubyEnumerator<E> |
maxBy()
Returns an enumerator of elements.
|
<S> E |
maxBy(java.util.Comparator<? super S> comp,
TransformBlock<? super E,? extends S> block)
Finds the max element for outputs transformed by the block and compared
by the Comparator.
|
<S> E |
maxBy(java.lang.String methodName,
java.lang.Object... args)
Finds the max element for outputs invoked by given method name.
|
<S> E |
maxBy(TransformBlock<? super E,? extends S> block)
Finds the max element for outputs transformed by the block.
|
boolean |
memberʔ(E target)
Equivalent to
RubyContract.Enumerable.includeʔ(Object) . |
E |
min()
Finds the min element.
|
E |
min(java.util.Comparator<? super E> comp)
Finds the min element for outputs compared by the Comparator.
|
RubyEnumerator<E> |
minBy()
Returns an enumerator of elements.
|
<S> E |
minBy(java.util.Comparator<? super S> comp,
TransformBlock<? super E,? extends S> block)
Finds the min element for outputs transformed by the block and compared
by the Comparator.
|
<S> E |
minBy(java.lang.String methodName,
java.lang.Object... args)
Finds min element for outputs invoked by given method name.
|
<S> E |
minBy(TransformBlock<? super E,? extends S> block)
Finds the min element for outputs transformed by the block.
|
RubyArray<E> |
minmax()
Finds the min and max elements.
|
RubyArray<E> |
minmax(java.util.Comparator<? super E> comp)
Finds the min and max elements for outputs compared by the Comparator.
|
RubyEnumerator<E> |
minmaxBy()
Returns an enumerator of elements.
|
<S> RubyArray<E> |
minmaxBy(java.util.Comparator<? super S> comp,
TransformBlock<? super E,? extends S> block)
Finds the min and max elements for outputs transformed by the block and
compared by the Comparator.
|
<S> RubyArray<E> |
minmaxBy(java.lang.String methodName,
java.lang.Object... args)
Finds the min and max elements for outputs invoked by given method name.
|
<S> RubyArray<E> |
minmaxBy(TransformBlock<? super E,? extends S> block)
Finds the min and max elements for outputs transformed by the block.
|
boolean |
noneʔ()
Checks if elements contain only null objects.
|
boolean |
noneʔ(BooleanBlock<? super E> block)
Checks if elements contain only elements which are false returned by the
block.
|
boolean |
oneʔ()
Checks if elements contain only one element beside null.
|
boolean |
oneʔ(BooleanBlock<? super E> block)
Checks if elements contain only one element which are true returned by
the block.
|
RubyEnumerator<E> |
partition()
Returns an enumerator of elements.
|
RubyArray<RubyArray<E>> |
partition(BooleanBlock<? super E> block)
Divides elements into 2 groups by the given block.
|
<I> I |
reduce(I init,
java.lang.String methodName)
Equivalent to
RubyContract.Enumerable.inject(Object, String) . |
<I> I |
reduce(I init,
WithInitBlock<? super E,I> block)
Equivalent to
RubyContract.Enumerable.inject(Object, WithInitBlock) . |
E |
reduce(ReduceBlock<E> block)
Equivalent to
RubyContract.Enumerable.inject(ReduceBlock) . |
E |
reduce(java.lang.String methodName)
Equivalent to
RubyContract.Enumerable.inject(String) . |
RubyEnumerator<E> |
reject()
Returns an enumerator of elements.
|
RubyArray<E> |
reject(BooleanBlock<? super E> block)
Filters all elements which are true returned by the block.
|
RubyEnumerator<E> |
reverseEach()
Returns a reversed enumerator of elements.
|
RubyEnumerable<E> |
reverseEach(Block<? super E> block)
Iterates each element reversely by given block.
|
RubyEnumerator<E> |
select()
Returns an enumerator of elements.
|
RubyArray<E> |
select(BooleanBlock<? super E> block)
Equivalent to
RubyContract.Enumerable.findAll(BooleanBlock) |
RubyEnumerator<RubyArray<E>> |
sliceBefore(BooleanBlock<? super E> block)
|
RubyEnumerator<RubyArray<E>> |
sliceBefore(java.lang.String regex)
|
RubyArray<E> |
sort()
Sorts elements and puts them into a
RubyArray . |
RubyEnumerator<E> |
sortBy()
Returns an enumerator of elements.
|
<S> RubyArray<E> |
sortBy(java.util.Comparator<? super E> comp1,
java.util.Comparator<? super S> comp2,
TransformBlock<? super E,? extends S> block)
Sorts elements by the ordering of outputs transformed by the block
induced by the Comparator for S and applies the Comparator for E again
before puts them into a
RubyArray . |
<S> RubyArray<E> |
sortBy(java.util.Comparator<? super S> comp,
TransformBlock<? super E,? extends S> block)
Sorts elements by the ordering of outputs transformed by the block
induced by the Comparator, then puts them into a
RubyArray . |
<S> RubyArray<E> |
sortBy(java.lang.String methodName,
java.lang.Object... args)
Sorts elements by the ordering of the outputs invoked by given method
name, then puts them into a
RubyArray . |
<S> RubyArray<E> |
sortBy(TransformBlock<? super E,? extends S> block)
Sorts elements by the ordering of outputs transformed by the block, then
puts them into a
RubyArray . |
RubyArray<E> |
take(int n)
Takes the first n elements.
|
RubyEnumerator<E> |
takeWhile()
Returns an enumerator which contains only the first element.
|
RubyArray<E> |
takeWhile(BooleanBlock<? super E> block)
Takes elements until an element gets false returned by the block.
|
RubyArray<E> |
toA()
Puts all elements into a
RubyArray . |
java.lang.String |
toString() |
RubyArray<RubyArray<E>> |
zip(java.lang.Iterable<? extends E>... others)
Groups elements which get the same indices among all other Iterables into
RubyArray s. |
RubyArray<RubyArray<E>> |
zip(java.util.List<? extends java.lang.Iterable<? extends E>> others)
Groups elements which get the same indices among all other Lists into
RubyArray s. |
void |
zip(java.util.List<? extends java.lang.Iterable<? extends E>> others,
Block<? super RubyArray<E>> block)
Groups elements which get the same indices among all other Iterables into
RubyArray s and yields them to the block. |
protected abstract java.lang.Iterable<E> getIterable()
public boolean allʔ()
RubyContract.Enumerable
allʔ
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
public boolean allʔ(BooleanBlock<? super E> block)
RubyContract.Enumerable
allʔ
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to check elementspublic boolean anyʔ()
RubyContract.Enumerable
anyʔ
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
public boolean anyʔ(BooleanBlock<? super E> block)
RubyContract.Enumerable
anyʔ
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to check elementspublic <S> RubyEnumerator<java.util.Map.Entry<S,RubyArray<E>>> chunk(TransformBlock<? super E,? extends S> block)
RubyArray
which contains
elements having the same result returned by the block and aside to each
other.chunk
in interface Ruby.Enumerable<E>
chunk
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsblock
- to chunk elementsRubyEnumerator
public <S> RubyEnumerator<java.util.Map.Entry<S,RubyArray<E>>> chunk(java.lang.String methodName, java.lang.Object... args)
RubyArray
which
contains elements having the same result returned by the block and aside
to each other.chunk
in interface Ruby.Enumerable<E>
chunk
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsmethodName
- name of a Methodargs
- arguments of a MethodRubyEnumerator
public RubyEnumerator<E> collect()
collect
in interface Ruby.Enumerable<E>
collect
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public <S> RubyArray<S> collect(TransformBlock<? super E,? extends S> block)
collect
in interface Ruby.Enumerable<E>
collect
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsblock
- to transform elementsRubyArray
public <S> RubyArray<S> collect(java.lang.String methodName, java.lang.Object... args)
collect
in interface Ruby.Enumerable<E>
collect
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsmethodName
- name of a Methodargs
- arguments of a MethodRubyArray
public RubyEnumerator<E> collectConcat()
collectConcat
in interface Ruby.Enumerable<E>
collectConcat
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public <S> RubyArray<S> collectConcat(TransformBlock<? super E,? extends java.util.List<? extends S>> block)
collectConcat
in interface Ruby.Enumerable<E>
collectConcat
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsblock
- to take element into a ListRubyArray
public int count()
RubyContract.Enumerable
count
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
public int count(BooleanBlock<? super E> block)
RubyContract.Enumerable
count
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to define elements to be countedpublic RubyEnumerator<E> cycle()
cycle
in interface Ruby.Enumerable<E>
cycle
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyEnumerator<E> cycle(int n)
cycle
in interface Ruby.Enumerable<E>
cycle
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
n
- times to repeatRubyEnumerator
public void cycle(int n, Block<? super E> block)
RubyContract.Enumerable
cycle
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
n
- times to repeatblock
- to yield each elementpublic void cycle(Block<? super E> block)
RubyContract.Enumerable
cycle
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to yield each elementpublic RubyEnumerator<E> detect()
detect
in interface Ruby.Enumerable<E>
detect
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public E detect(BooleanBlock<? super E> block)
RubyContract.Enumerable
detect
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to filter elementspublic RubyArray<E> drop(int n)
drop
in interface Ruby.Enumerable<E>
drop
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
n
- number of elements to dropRubyArray
public RubyEnumerator<E> dropWhile()
dropWhile
in interface Ruby.Enumerable<E>
dropWhile
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyArray<E> dropWhile(BooleanBlock<? super E> block)
dropWhile
in interface Ruby.Enumerable<E>
dropWhile
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to define which elements to be droppedRubyArray
public RubyEnumerator<E> each()
each
in interface Ruby.Enumerable<E>
each
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyEnumerable<E> each(Block<? super E> block)
each
in interface Ruby.Enumerable<E>
each
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to yield each elementRubyEnumerable
public RubyEnumerator<RubyArray<E>> eachCons(int n)
RubyArray
.eachCons
in interface Ruby.Enumerable<E>
eachCons
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
n
- number of consecutive elementsRubyEnumerator
public void eachCons(int n, Block<? super RubyArray<E>> block)
RubyContract.Enumerable
eachCons
in interface Ruby.Enumerable<E>
eachCons
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
n
- number of consecutive elementsblock
- to yield the List of consecutive elementspublic RubyEnumerator<E> eachEntry()
eachEntry
in interface Ruby.Enumerable<E>
eachEntry
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyEnumerable<E> eachEntry(Block<? super E> block)
eachEntry
in interface Ruby.Enumerable<E>
eachEntry
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to yield each elementRubyEnumerable
public RubyEnumerator<RubyArray<E>> eachSlice(int n)
RubyArray
s with length n.eachSlice
in interface Ruby.Enumerable<E>
eachSlice
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
n
- size of each sliceRubyEnumerator
public void eachSlice(int n, Block<? super RubyArray<E>> block)
RubyContract.Enumerable
RubyArray
s with length n and yield them to
the block.eachSlice
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
n
- size of each sliceblock
- to yield each slicepublic RubyEnumerator<java.util.Map.Entry<E,java.lang.Integer>> eachWithIndex()
eachWithIndex
in interface Ruby.Enumerable<E>
eachWithIndex
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyEnumerable<E> eachWithIndex(WithIndexBlock<? super E> block)
eachWithIndex
in interface Ruby.Enumerable<E>
eachWithIndex
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to yield each elementRubyEnumerable
public <O> RubyEnumerator<java.util.Map.Entry<E,O>> eachWithObject(O obj)
eachWithObject
in interface Ruby.Enumerable<E>
eachWithObject
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
O
- the type of transformed elementsobj
- an object ORubyEnumerator
public <O> O eachWithObject(O obj, WithObjectBlock<? super E,? super O> block)
RubyContract.Enumerable
eachWithObject
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
O
- the type of transformed elementsobj
- an object Oblock
- to yield each Entrypublic RubyArray<E> entries()
RubyContract.Enumerable
RubyArray
.entries
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyArray
public RubyEnumerator<E> find()
RubyContract.Enumerable.detect()
.find
in interface Ruby.Enumerable<E>
find
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public E find(BooleanBlock<? super E> block)
RubyContract.Enumerable
RubyContract.Enumerable.detect(BooleanBlock)
.find
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to filter elementspublic RubyEnumerator<E> findAll()
findAll
in interface Ruby.Enumerable<E>
findAll
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyArray<E> findAll(BooleanBlock<? super E> block)
findAll
in interface Ruby.Enumerable<E>
findAll
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to filter elementsRubyArray
public RubyEnumerator<E> findIndex()
findIndex
in interface Ruby.Enumerable<E>
findIndex
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public java.lang.Integer findIndex(BooleanBlock<? super E> block)
RubyContract.Enumerable
findIndex
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to check elementspublic java.lang.Integer findIndex(E target)
RubyContract.Enumerable
findIndex
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
target
- to be foundpublic E first()
RubyContract.Enumerable
first
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
public RubyArray<E> first(int n)
RubyContract.Enumerable
first
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
n
- number of elementsRubyArray
public RubyEnumerator<E> flatMap()
RubyContract.Enumerable.collectConcat()
.flatMap
in interface Ruby.Enumerable<E>
flatMap
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public <S> RubyArray<S> flatMap(TransformBlock<? super E,? extends java.util.List<? extends S>> block)
RubyContract.Enumerable.collectConcat(TransformBlock)
.flatMap
in interface Ruby.Enumerable<E>
flatMap
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsblock
- to take element into a ListRubyArray
public RubyArray<E> grep(java.lang.String regex)
grep
in interface Ruby.Enumerable<E>
grep
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
regex
- regular expressionRubyArray
public <S> RubyArray<S> grep(java.lang.String regex, TransformBlock<? super E,? extends S> block)
grep
in interface Ruby.Enumerable<E>
grep
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsregex
- regular expressionblock
- to transform elementsRubyArray
public <S> RubyArray<S> grep(java.lang.String regex, java.lang.String methodName, java.lang.Object... args)
grep
in interface Ruby.Enumerable<E>
grep
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsregex
- regular expressionmethodName
- name of a Methodargs
- arguments of a MethodRubyArray
public RubyEnumerator<E> groupBy()
groupBy
in interface Ruby.Enumerable<E>
groupBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public <S> RubyHash<S,RubyArray<E>> groupBy(TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable
RubyHash
.groupBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsblock
- to group each elementRubyHash
public <S> RubyHash<S,RubyArray<E>> groupBy(java.lang.String methodName, java.lang.Object... args)
RubyContract.Enumerable
RubyHash
.groupBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsmethodName
- name of a Methodargs
- arguments of a MethodRubyHash
public boolean includeʔ(E target)
RubyContract.Enumerable
includeʔ
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
target
- to be searchedpublic E inject(ReduceBlock<E> block)
RubyContract.Enumerable
inject
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to reduce each elementpublic <I> I inject(I init, WithInitBlock<? super E,I> block)
RubyContract.Enumerable
inject
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
I
- the type of transformed elementsinit
- initial valueblock
- to reduce each elementpublic <I> I inject(I init, java.lang.String methodName)
RubyContract.Enumerable
inject
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
I
- the type of transformed elementsinit
- initial valuemethodName
- method used to reduce elementspublic E inject(java.lang.String methodName)
RubyContract.Enumerable
inject
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
methodName
- method used to reduce elementspublic RubyLazyEnumerator<E> lazy()
RubyContract.Enumerable
RubyLazyEnumerator
.lazy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyLazyEnumerator
public RubyEnumerator<E> map()
map
in interface Ruby.Enumerable<E>
map
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public <S> RubyArray<S> map(TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable.collect(TransformBlock)
.map
in interface Ruby.Enumerable<E>
map
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsblock
- to transform elementsRubyArray
public <S> RubyArray<S> map(java.lang.String methodName, java.lang.Object... args)
RubyContract.Enumerable.collect(String, Object...)
.map
in interface Ruby.Enumerable<E>
map
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsmethodName
- name of a Methodargs
- arguments of a MethodRubyArray
public E max()
RubyContract.Enumerable
max
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
public E max(java.util.Comparator<? super E> comp)
RubyContract.Enumerable
max
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
comp
- a Comparatorpublic RubyEnumerator<E> maxBy()
maxBy
in interface Ruby.Enumerable<E>
maxBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public <S> E maxBy(java.util.Comparator<? super S> comp, TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable
maxBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementscomp
- a Comparatorblock
- to transform elementspublic <S> E maxBy(TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable
maxBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsblock
- to transform elementspublic <S> E maxBy(java.lang.String methodName, java.lang.Object... args)
RubyContract.Enumerable
maxBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsmethodName
- name of a Methodargs
- arguments of a Methodpublic boolean memberʔ(E target)
RubyContract.Enumerable
RubyContract.Enumerable.includeʔ(Object)
.memberʔ
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
target
- to be foundpublic E min()
RubyContract.Enumerable
min
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
public E min(java.util.Comparator<? super E> comp)
RubyContract.Enumerable
min
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
comp
- a Comparatorpublic RubyEnumerator<E> minBy()
minBy
in interface Ruby.Enumerable<E>
minBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public <S> E minBy(java.util.Comparator<? super S> comp, TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable
minBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementscomp
- a Comparatorblock
- to transform elementspublic <S> E minBy(TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable
minBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsblock
- to transform elementspublic <S> E minBy(java.lang.String methodName, java.lang.Object... args)
RubyContract.Enumerable
minBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsmethodName
- name of a Methodargs
- arguments of a Methodpublic RubyArray<E> minmax()
RubyContract.Enumerable
minmax
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyArray
public RubyArray<E> minmax(java.util.Comparator<? super E> comp)
RubyContract.Enumerable
minmax
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
comp
- a ComparatorRubyArray
public RubyEnumerator<E> minmaxBy()
minmaxBy
in interface Ruby.Enumerable<E>
minmaxBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public <S> RubyArray<E> minmaxBy(java.util.Comparator<? super S> comp, TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable
minmaxBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementscomp
- a Comparatorblock
- to transform elementsRubyArray
public <S> RubyArray<E> minmaxBy(TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable
minmaxBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsblock
- to transform elementsRubyArray
public <S> RubyArray<E> minmaxBy(java.lang.String methodName, java.lang.Object... args)
RubyContract.Enumerable
minmaxBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsmethodName
- name of a Methodargs
- arguments of a MethodRubyArray
public boolean noneʔ()
RubyContract.Enumerable
noneʔ
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
public boolean noneʔ(BooleanBlock<? super E> block)
RubyContract.Enumerable
noneʔ
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to check elementspublic boolean oneʔ()
RubyContract.Enumerable
oneʔ
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
public boolean oneʔ(BooleanBlock<? super E> block)
RubyContract.Enumerable
oneʔ
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to check elementspublic RubyEnumerator<E> partition()
partition
in interface Ruby.Enumerable<E>
partition
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyArray<RubyArray<E>> partition(BooleanBlock<? super E> block)
RubyContract.Enumerable
partition
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to part elementsRubyArray
of 2 RubyArray
spublic E reduce(ReduceBlock<E> block)
RubyContract.Enumerable
RubyContract.Enumerable.inject(ReduceBlock)
.reduce
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to reduce each elementpublic <I> I reduce(I init, WithInitBlock<? super E,I> block)
RubyContract.Enumerable
RubyContract.Enumerable.inject(Object, WithInitBlock)
.reduce
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
I
- the type of transformed elementsinit
- initial valueblock
- to reduce each elementpublic <I> I reduce(I init, java.lang.String methodName)
RubyContract.Enumerable
RubyContract.Enumerable.inject(Object, String)
.reduce
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
I
- the type of transformed elementsinit
- initial valuemethodName
- method used to reduce elementspublic E reduce(java.lang.String methodName)
RubyContract.Enumerable
RubyContract.Enumerable.inject(String)
.reduce
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
methodName
- method used to reduce elementspublic RubyEnumerator<E> reject()
reject
in interface Ruby.Enumerable<E>
reject
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyArray<E> reject(BooleanBlock<? super E> block)
reject
in interface Ruby.Enumerable<E>
reject
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to filter elementsRubyArray
public RubyEnumerator<E> reverseEach()
reverseEach
in interface Ruby.Enumerable<E>
reverseEach
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyEnumerable<E> reverseEach(Block<? super E> block)
reverseEach
in interface Ruby.Enumerable<E>
reverseEach
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to yield each elementRubyEnumerable
public RubyEnumerator<E> select()
select
in interface Ruby.Enumerable<E>
select
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyArray<E> select(BooleanBlock<? super E> block)
RubyContract.Enumerable.findAll(BooleanBlock)
select
in interface Ruby.Enumerable<E>
select
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to filter elementsRubyArray
public RubyEnumerator<RubyArray<E>> sliceBefore(BooleanBlock<? super E> block)
RubyArray
s and the first element of each
RubyArray
should get true returned by the block.sliceBefore
in interface Ruby.Enumerable<E>
sliceBefore
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to check where to do sliceRubyEnumerator
public RubyEnumerator<RubyArray<E>> sliceBefore(java.lang.String regex)
RubyArray
s and the first element of each
RubyArray
should be matched by the regex.sliceBefore
in interface Ruby.Enumerable<E>
sliceBefore
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
regex
- to check where to do sliceRubyEnumerator
public RubyArray<E> sort()
RubyContract.Enumerable
RubyArray
.sort
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyArray
public RubyEnumerator<E> sortBy()
sortBy
in interface Ruby.Enumerable<E>
sortBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public <S> RubyArray<E> sortBy(java.util.Comparator<? super S> comp, TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable
RubyArray
.sortBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementscomp
- a Comparatorblock
- to transform elementsRubyArray
public <S> RubyArray<E> sortBy(java.util.Comparator<? super E> comp1, java.util.Comparator<? super S> comp2, TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable
RubyArray
.sortBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementscomp1
- a Comparator for Ecomp2
- a Comparator for Sblock
- to transform elementsRubyArray
public <S> RubyArray<E> sortBy(TransformBlock<? super E,? extends S> block)
RubyContract.Enumerable
RubyArray
.sortBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
S
- the type of transformed elementsblock
- to transform elementsRubyArray
public <S> RubyArray<E> sortBy(java.lang.String methodName, java.lang.Object... args)
RubyContract.Enumerable
RubyArray
.sortBy
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
methodName
- name of a Methodargs
- arguments of a MethodRubyArray
public RubyArray<E> take(int n)
take
in interface Ruby.Enumerable<E>
take
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
n
- number of elementsRubyArray
public RubyEnumerator<E> takeWhile()
takeWhile
in interface Ruby.Enumerable<E>
takeWhile
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyEnumerator
public RubyArray<E> takeWhile(BooleanBlock<? super E> block)
takeWhile
in interface Ruby.Enumerable<E>
takeWhile
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
block
- to filter elementsRubyArray
public RubyArray<E> toA()
RubyContract.Enumerable
RubyArray
.toA
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
RubyArray
public RubyArray<RubyArray<E>> zip(java.lang.Iterable<? extends E>... others)
RubyArray
s.zip
in interface Ruby.Enumerable<E>
zip
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
others
- an array of IterableRubyArray
public RubyArray<RubyArray<E>> zip(java.util.List<? extends java.lang.Iterable<? extends E>> others)
RubyArray
s.zip
in interface Ruby.Enumerable<E>
zip
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
others
- a List of IterableRubyArray
public void zip(java.util.List<? extends java.lang.Iterable<? extends E>> others, Block<? super RubyArray<E>> block)
RubyContract.Enumerable
RubyArray
s and yields them to the block.zip
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
others
- a List of Iterablesblock
- to yield zipped elementspublic java.util.Iterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
public java.lang.String toString()
toString
in class java.lang.Object