E
- the type of the elementspublic final class RubyArray<E> extends RubyEnumerable<E> implements java.util.List<E>, java.lang.Comparable<java.util.List<E>>, java.io.Serializable
RubyArray
implements all methods refer to the Array class of Ruby
language.
RubyArray
is also a Java List and a Ruby.Enumerable
.
Constructor and Description |
---|
RubyArray()
Creates a
RubyArray . |
RubyArray(java.lang.Iterable<? extends E> iter)
Creates a
RubyArray by given Iterable. |
RubyArray(java.util.List<E> list)
Creates a
RubyArray by given List. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
void |
add(int index,
E element) |
boolean |
addAll(java.util.Collection<? extends E> c) |
boolean |
addAll(int index,
java.util.Collection<? extends E> c) |
<S> RubyArray<S> |
assoc(S target)
Finds a List element which contains the target as the first element.
|
E |
at(int index)
Returns the element at any index.
|
E |
bsearch(E target)
Uses binary search to find an element.
|
E |
bsearch(E target,
java.util.Comparator<? super E> comp)
Uses binary search with a Comparator to Finds an element.
|
E |
bsearch(TransformBlock<? super E,java.lang.Integer> block)
Uses binary search and a block to find an element.
|
void |
clear() |
RubyArray<E> |
collectǃ(java.lang.String methodName,
java.lang.Object... args)
Transforms each element by given method name in self.
|
RubyArray<E> |
collectǃ(TransformBlock<? super E,? extends E> block)
Transforms each element in self.
|
RubyEnumerator<RubyArray<E>> |
combination(int n)
Generates all combinations with length n of this
RubyArray . |
RubyArray<E> |
combination(int n,
Block<? super RubyArray<E>> block)
Generates all combinations of length n with elements of this
RubyArray and yields them with a block. |
RubyArray<E> |
compact()
Removes all null elements and puts the rest into a new
RubyArray . |
RubyArray<E> |
compactǃ()
Removes all null elements in this
RubyArray . |
int |
compareTo(java.util.List<E> arg0) |
RubyArray<E> |
concat(java.util.Collection<? extends E> other)
Appends all elements of other Collection in this
RubyArray . |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
static <E> RubyArray<E> |
copyOf(java.lang.Iterable<E> elements)
Returns a
RubyArray which copies the elements of given Iterable. |
int |
count(E target)
Returns a total number of the target element in this
RubyArray . |
E |
delete(E target)
Deletes all elements which equal to the target.
|
E |
delete(E target,
TransformBlock<? super E,? extends E> block)
Deletes all elements which equals to target.
|
E |
deleteAt(int index)
Deletes the element of any index.
|
RubyEnumerator<E> |
deleteIf()
Returns a
RubyEnumerator of this RubyArray . |
RubyArray<E> |
deleteIf(BooleanBlock<? super E> block)
Deletes elements which are true returned by the block.
|
RubyArray<E> |
each(Block<? super E> block)
Yields each element to the block.
|
RubyEnumerator<java.lang.Integer> |
eachIndex()
Returns a
RubyEnumerator of this RubyArray . |
RubyArray<E> |
eachIndex(Block<java.lang.Integer> block)
Yields each index of elements to the block.
|
boolean |
emptyʔ()
Checks if this is an empty
RubyArray . |
boolean |
eqlʔ(java.lang.Object o)
Equivalent to
equals(Object) . |
boolean |
equals(java.lang.Object o) |
E |
fetch(int index)
Returns the element at an index.
|
E |
fetch(int index,
Block<java.lang.Integer> block)
Returns the element at an index.
|
E |
fetch(int index,
E defaultValue)
Returns the element at an index.
|
RubyArray<E> |
fill(E item)
Fills the whole
RubyArray with the element. |
RubyArray<E> |
fill(E item,
int start)
Starts to fill this
RubyArray from an index with the element. |
RubyArray<E> |
fill(E item,
int start,
int length)
Starts to fill part of this
RubyArray from an index with the
element. |
RubyArray<E> |
fill(int start,
int length,
TransformBlock<java.lang.Integer,? extends E> block)
Starts to fill part of this
RubyArray from an index with elements
returned by the block. |
RubyArray<E> |
fill(int start,
TransformBlock<java.lang.Integer,? extends E> block)
Starts to fill this
RubyArray from an index with elements returned
by the block. |
RubyArray<E> |
fill(TransformBlock<java.lang.Integer,? extends E> block)
Fills the whole
RubyArray with elements returned by the block. |
<S> RubyArray<S> |
flatten()
|
<S> RubyArray<S> |
flatten(int n)
|
RubyArray<E> |
freeze()
Freezes this
RubyArray . |
boolean |
frozenʔ()
Checks if this
RubyArray is frozen. |
E |
get(int index) |
protected java.lang.Iterable<E> |
getIterable()
Returns an Iterable of elements.
|
int |
hash()
Equivalent to
hashCode() . |
int |
hashCode() |
java.lang.Integer |
index(BooleanBlock<? super E> block)
Finds the first index of an element which gets true returned by the block.
|
java.lang.Integer |
index(E target)
Finds the index of an element.
|
int |
indexOf(java.lang.Object o) |
RubyArray<E> |
insert(int index,
E... args)
Starts to insert elements to this
RubyArray from given index. |
java.lang.String |
inspect()
Equivalent to
toString() . |
RubyArray<E> |
intersection(java.util.Collection<? extends E> other)
Puts all common elements into a new
RubyArray . |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
java.lang.String |
join()
Transforms each element to a String, then joins them.
|
java.lang.String |
join(java.lang.String separator)
Transforms each element to a String, then joins them by given separator.
|
RubyEnumerator<E> |
keepIf()
Returns a
RubyEnumerator of this RubyArray . |
RubyArray<E> |
keepIf(BooleanBlock<? super E> block)
Keeps elements which are true returned by the block.
|
E |
last()
Returns the last element of this
RubyArray . |
RubyArray<E> |
last(int n)
Returns last n elements of this
RubyArray . |
int |
lastIndexOf(java.lang.Object o) |
int |
length()
Equivalent to
size() . |
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
RubyArray<E> |
mapǃ(java.lang.String methodName,
java.lang.Object... args)
Equivalent to
collectǃ(String, Object...) . |
RubyArray<E> |
mapǃ(TransformBlock<? super E,? extends E> block)
Equivalent to
collectǃ(TransformBlock) . |
RubyArray<E> |
minus(java.util.Collection<? extends E> other)
Eliminates all elements from other Collection and puts the result into a
new
RubyArray . |
RubyArray<E> |
multiply(int n)
Multiplies this
RubyArray by n times. |
java.lang.String |
multiply(java.lang.String separator)
Equivalent to
join(String) . |
static <E> RubyArray<E> |
of(java.util.List<E> list)
Returns a
RubyArray which wraps the given List. |
java.lang.String |
pack(java.lang.String aTemplateString)
Packs the contents of this
RubyArray into a binary string according
to the directives in aTemplateString. |
RubyEnumerator<RubyArray<E>> |
permutation()
Generates a
RubyEnumerator which contains all permutations of this
RubyArray . |
RubyArray<E> |
permutation(Block<? super RubyArray<E>> block)
Yields all permutations of this
RubyArray to the block. |
RubyEnumerator<RubyArray<E>> |
permutation(int n)
Generates a
RubyEnumerator which contains all permutations with
length n of this RubyArray . |
RubyArray<E> |
permutation(int n,
Block<? super RubyArray<E>> block)
Yields all permutations with length n of this
RubyArray to the
block. |
RubyArray<E> |
plus(java.util.Collection<? extends E> other)
Appends other Collection to self and puts the result into a new
RubyArray . |
E |
pop()
Removes and returns the last element of this
RubyArray . |
RubyArray<E> |
pop(int n)
Removes and returns the last n element of this
RubyArray . |
RubyArray<RubyArray<E>> |
product(java.util.List<? extends E>... others)
Generates the production of self with other Lists.
|
RubyArray<RubyArray<E>> |
product(java.util.List<? extends java.util.List<? extends E>> others)
Generates the production of self with a List of Lists.
|
RubyArray<E> |
product(java.util.List<? extends java.util.List<? extends E>> others,
Block<RubyArray<E>> block)
Generates the productions of self with a List of Lists and yield them to
the block.
|
RubyArray<E> |
push(E... items)
Adds items to the end of this
RubyArray . |
RubyArray<E> |
push(E item)
Adds the item to the end of this
RubyArray . |
<S> RubyArray<S> |
rassoc(S target)
Finds a List element which contains target as the last element.
|
RubyEnumerator<E> |
rejectǃ()
Returns a
RubyEnumerator of this RubyArray . |
RubyArray<E> |
rejectǃ(BooleanBlock<? super E> block)
Deletes all elements which are false returned by the block.
|
E |
remove(int index) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
RubyEnumerator<RubyArray<E>> |
repeatedCombination(int n)
Generates all repeated combinations of this
RubyArray . |
RubyArray<E> |
repeatedCombination(int n,
Block<? super RubyArray<E>> block)
Generates all repeated combinations with length n of this
RubyArray
and yield to the block. |
RubyEnumerator<RubyArray<E>> |
repeatedPermutation(int n)
Generates all repeated permutations with length n of this
RubyArray
. |
RubyArray<E> |
repeatedPermutation(int n,
Block<? super RubyArray<E>> block)
Generates all repeated permutations with length n of this
RubyArray
and yield to the block. |
RubyArray<E> |
replace(java.util.Collection<? extends E> other)
Replaces all elements of self with other List.
|
boolean |
retainAll(java.util.Collection<?> c) |
RubyArray<E> |
reverse()
|
RubyArray<E> |
reverseǃ()
Reverses this
RubyArray . |
RubyEnumerator<E> |
rindex()
Returns a
RubyEnumerator of this RubyArray reversed. |
java.lang.Integer |
rindex(BooleanBlock<? super E> block)
Finds the last index of the element which gets true returned by the block.
|
java.lang.Integer |
rindex(E target)
Finds the last index of the target element.
|
RubyArray<E> |
rotate()
Moves the first element to the last and puts them into a new
RubyArray . |
RubyArray<E> |
rotate(int n)
Moves the first element to the last n times and puts them into a new
RubyArray.
|
RubyArray<E> |
rotateǃ()
Moves the first element to the last.
|
RubyArray<E> |
rotateǃ(int n)
Moves the first element to the last n times.
|
E |
sample()
Picks an element randomly.
|
RubyArray<E> |
sample(int n)
Picks n element randomly.
|
RubyEnumerator<E> |
selectǃ()
Returns a
RubyEnumerator of this RubyArray . |
RubyArray<E> |
selectǃ(BooleanBlock<? super E> block)
Selects elements which the result returned by the block are false.
|
E |
set(int index,
E element) |
E |
shift()
Removes and returns the first element.
|
RubyArray<E> |
shift(int n)
Removes and returns the first n element.
|
RubyArray<E> |
shuffle()
|
RubyArray<E> |
shuffleǃ()
Shuffles this
RubyArray . |
int |
size() |
E |
slice(int index)
Equivalent to
at(int) . |
RubyArray<E> |
slice(int index,
int length)
|
E |
sliceǃ(int index)
Removes and returns an element of given index out of this
RubyArray
. |
RubyArray<E> |
sliceǃ(int index,
int length)
Slices an interval of this
RubyArray out of self. |
RubyEnumerator<E> |
sortByǃ()
Return a
RubyEnumerator of this RubyArray . |
<S> RubyArray<E> |
sortByǃ(java.util.Comparator<? super E> comp1,
java.util.Comparator<? super S> comp2,
TransformBlock<? super E,? extends S> block)
Sorts elements of this
RubyArray by the ordering of outputs
transformed by the block induced by the Comparator for S and applies the
Comparator for E again. |
<S> RubyArray<E> |
sortByǃ(java.util.Comparator<? super S> comp,
TransformBlock<? super E,? extends S> block)
Sorts elements of this
RubyArray by the ordering of outputs
transformed by the block induced by the Comparator. |
<S> RubyArray<E> |
sortByǃ(java.lang.String methodName,
java.lang.Object... args)
Sorts elements of this
RubyArray by the ordering of outputs invoked
by given method name. |
<S> RubyArray<E> |
sortByǃ(TransformBlock<? super E,? extends S> block)
Sorts elements of this
RubyArray by the ordering of putputs
transformed by the block. |
RubyArray<E> |
sortǃ()
Sorts this
RubyArray . |
RubyArray<E> |
sortǃ(java.util.Comparator<? super E> comp)
Sorts this
RubyArray by given Comparator. |
java.util.List<E> |
subList(int fromIndex,
int toIndex) |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toS()
Equivalent to
toString() . |
java.lang.String |
toString() |
<S> RubyArray<RubyArray<S>> |
transpose()
|
RubyArray<E> |
union(java.util.Collection<? extends E> other)
Puts all distinct elements into a new
RubyArray . |
RubyArray<E> |
uniq()
Filters elements uniquely and puts the result into a new
RubyArray . |
<S> RubyArray<E> |
uniq(java.lang.String methodName,
java.lang.Object... args)
Filters elements by the result invoked by given method name uniquely and
puts the result into a new
RubyArray . |
<S> RubyArray<E> |
uniq(TransformBlock<? super E,? extends S> block)
Filters elements by the result returned by the block uniquely and puts the
result into a new
RubyArray . |
RubyArray<E> |
uniqǃ()
Filters elements uniquely.
|
<S> RubyArray<E> |
uniqǃ(java.lang.String methodName,
java.lang.Object... args)
Filters elements by the result invoked by given method name uniquely and
puts the result into a new
RubyArray . |
<S> RubyArray<E> |
uniqǃ(TransformBlock<? super E,? extends S> block)
Filters elements by the result returned by the block uniquely.
|
RubyArray<E> |
unshift(E item)
Puts an element at beginning of this
RubyArray |
RubyArray<E> |
valuesAt(int... indices)
Puts all elements from given indices into a new
RubyArray . |
RubyArray<E> |
valuesAt(java.lang.Iterable<java.lang.Integer> indices)
Puts all elements from given indices into a new
RubyArray . |
allʔ, allʔ, anyʔ, anyʔ, chunk, chunk, collect, collect, collect, collectConcat, collectConcat, count, count, cycle, cycle, cycle, cycle, detect, detect, drop, dropWhile, dropWhile, each, eachCons, eachCons, eachEntry, eachEntry, eachSlice, eachSlice, eachWithIndex, eachWithIndex, eachWithObject, eachWithObject, entries, find, find, findAll, findAll, findIndex, findIndex, findIndex, first, first, flatMap, flatMap, grep, grep, grep, groupBy, groupBy, groupBy, includeʔ, inject, inject, inject, inject, lazy, map, map, map, max, max, maxBy, maxBy, maxBy, maxBy, memberʔ, min, min, minBy, minBy, minBy, minBy, minmax, minmax, minmaxBy, minmaxBy, minmaxBy, minmaxBy, noneʔ, noneʔ, oneʔ, oneʔ, partition, partition, reduce, reduce, reduce, reduce, reject, reject, reverseEach, reverseEach, select, select, sliceBefore, sliceBefore, sort, sortBy, sortBy, sortBy, sortBy, sortBy, take, takeWhile, takeWhile, toA, zip, zip, zip
public RubyArray()
RubyArray
.public RubyArray(java.util.List<E> list)
RubyArray
by given List. It's a wrapper implementation.
No defensive copy has been made.list
- a Listjava.lang.NullPointerException
- if list is nullpublic static <E> RubyArray<E> of(java.util.List<E> list)
RubyArray
which wraps the given List.list
- any ListRubyArray
java.lang.NullPointerException
- if list is nullpublic static <E> RubyArray<E> copyOf(java.lang.Iterable<E> elements)
RubyArray
which copies the elements of given Iterable.elements
- any IterableRubyArray
java.lang.NullPointerException
- if elements is nullprotected java.lang.Iterable<E> getIterable()
RubyEnumerable
getIterable
in class RubyEnumerable<E>
public <S> RubyArray<S> assoc(S target)
S
- the type of a Listtarget
- the first element of returned Listpublic E at(int index)
index
- of an elementpublic E bsearch(E target)
RubyArray
is
already sorted.target
- to be searchedpublic E bsearch(E target, java.util.Comparator<? super E> comp)
RubyArray
is already sorted.target
- to be searchedcomp
- a Comparator is used to sort this RubyArray
public E bsearch(TransformBlock<? super E,java.lang.Integer> block)
RubyArray
is already sorted.block
- to filter elementspublic RubyArray<E> collectǃ(TransformBlock<? super E,? extends E> block)
block
- to transform elementsRubyArray
public RubyArray<E> collectǃ(java.lang.String methodName, java.lang.Object... args)
methodName
- name of a Methodargs
- arguments of a MethodRubyArray
public RubyEnumerator<RubyArray<E>> combination(int n)
RubyArray
.n
- length of all combinationsRubyEnumerator
public RubyArray<E> combination(int n, Block<? super RubyArray<E>> block)
RubyArray
and yields them with a block.n
- length of all combinationsblock
- to yield each combinationRubyArray
public RubyArray<E> compact()
RubyArray
.RubyArray
public RubyArray<E> compactǃ()
RubyArray
. Returns null if
nothing is removed.RubyArray
or nullpublic RubyArray<E> concat(java.util.Collection<? extends E> other)
RubyArray
.other
- a CollectionRubyArray
public int count(E target)
RubyArray
.target
- to be countedpublic E delete(E target)
target
- to be deletedpublic E delete(E target, TransformBlock<? super E,? extends E> block)
target
- to be deletedblock
- to yield if nothing is deletedpublic E deleteAt(int index)
index
- of an elementpublic RubyEnumerator<E> deleteIf()
RubyEnumerator
of this RubyArray
.RubyEnumerator
public RubyArray<E> deleteIf(BooleanBlock<? super E> block)
block
- to filter elementsRubyArray
public RubyArray<E> each(Block<? super E> block)
each
in interface Ruby.Enumerable<E>
each
in interface RubyContract.Enumerable<E,Ruby.Enumerator<?>,RubyArray<?>>
each
in class RubyEnumerable<E>
block
- to yield each elementRubyArray
public RubyEnumerator<java.lang.Integer> eachIndex()
RubyEnumerator
of this RubyArray
.RubyEnumerator
public RubyArray<E> eachIndex(Block<java.lang.Integer> block)
block
- to yield elementsRubyArray
public boolean emptyʔ()
RubyArray
.RubyArray
is empty, false otherwisepublic boolean eqlʔ(java.lang.Object o)
equals(Object)
.o
- an Objectpublic E fetch(int index)
index
- of an elementjava.lang.IndexOutOfBoundsException
- if index is not foundpublic E fetch(int index, E defaultValue)
index
- of an elementdefaultValue
- the default value while index is not foundpublic E fetch(int index, Block<java.lang.Integer> block)
index
- of an elementblock
- to yield if index is not foundpublic RubyArray<E> fill(E item)
RubyArray
with the element.item
- to be filledRubyArray
public RubyArray<E> fill(E item, int start)
RubyArray
from an index with the element.item
- to be filledstart
- where to beginRubyArray
public RubyArray<E> fill(E item, int start, int length)
RubyArray
from an index with the
element.item
- to be filledstart
- where to beginlength
- of the interval to be filledRubyArray
public RubyArray<E> fill(TransformBlock<java.lang.Integer,? extends E> block)
RubyArray
with elements returned by the block.block
- to transform elements to be filledRubyArray
public RubyArray<E> fill(int start, TransformBlock<java.lang.Integer,? extends E> block)
RubyArray
from an index with elements returned
by the block.start
- where to beginblock
- to transform elements to be filledRubyArray
public RubyArray<E> fill(int start, int length, TransformBlock<java.lang.Integer,? extends E> block)
RubyArray
from an index with elements
returned by the block.start
- where to beginlength
- of the interval to be filledblock
- to transform elements to be filledRubyArray
public <S> RubyArray<S> flatten()
public <S> RubyArray<S> flatten(int n)
n
- times to flattenRubyArray
public boolean frozenʔ()
RubyArray
is frozen.RubyArray
is frozen, false otherwisepublic int hash()
hashCode()
.public java.lang.Integer index(BooleanBlock<? super E> block)
block
- to filter elementspublic java.lang.Integer index(E target)
target
- to be foundpublic RubyArray<E> insert(int index, E... args)
RubyArray
from given index.index
- where to beginargs
- elements to be insertedRubyArray
java.lang.IndexOutOfBoundsException
- if index is less than -sizepublic java.lang.String inspect()
toString()
.public RubyArray<E> intersection(java.util.Collection<? extends E> other)
RubyArray
.other
- a CollectionRubyArray
public java.lang.String join()
public java.lang.String join(java.lang.String separator)
separator
- used to join elementspublic RubyEnumerator<E> keepIf()
RubyEnumerator
of this RubyArray
.RubyEnumerator
public RubyArray<E> keepIf(BooleanBlock<? super E> block)
block
- to filter elementsRubyArray
public E last()
public RubyArray<E> last(int n)
RubyArray
.n
- number of elementsRubyArray
java.lang.IllegalArgumentException
- if n is less than 0public RubyArray<E> mapǃ(TransformBlock<? super E,? extends E> block)
collectǃ(TransformBlock)
.block
- to transform elementsRubyArray
public RubyArray<E> mapǃ(java.lang.String methodName, java.lang.Object... args)
collectǃ(String, Object...)
.methodName
- name of a Methodargs
- arguments of a MethodRubyArray
public RubyArray<E> multiply(int n)
RubyArray
by n times.n
- multiply n timesRubyArray
java.lang.IllegalArgumentException
- if n is less than 0public java.lang.String multiply(java.lang.String separator)
join(String)
.separator
- used to join elementspublic java.lang.String pack(java.lang.String aTemplateString)
RubyArray
into a binary string according
to the directives in aTemplateString.aTemplateString
- a template stringDirective
public RubyEnumerator<RubyArray<E>> permutation()
RubyEnumerator
which contains all permutations of this
RubyArray
.RubyEnumerator
public RubyEnumerator<RubyArray<E>> permutation(int n)
RubyEnumerator
which contains all permutations with
length n of this RubyArray
.n
- length of each permutationRubyEnumerator
public RubyArray<E> permutation(int n, Block<? super RubyArray<E>> block)
RubyArray
to the
block.n
- length of each permutationblock
- to yield each permutationRubyArray
public RubyArray<E> permutation(Block<? super RubyArray<E>> block)
RubyArray
to the block.block
- to yield each permutationRubyArray
public RubyArray<E> plus(java.util.Collection<? extends E> other)
RubyArray
.other
- a CollectionRubyArray
public RubyArray<E> pop(int n)
RubyArray
.n
- number of elementsRubyArray
java.lang.IllegalArgumentException
- if n is less than 0public RubyArray<RubyArray<E>> product(java.util.List<? extends E>... others)
public RubyArray<RubyArray<E>> product(java.util.List<? extends java.util.List<? extends E>> others)
public RubyArray<E> product(java.util.List<? extends java.util.List<? extends E>> others, Block<RubyArray<E>> block)
others
- a List of Listsblock
- to yield each productionRubyArray
public RubyArray<E> push(E item)
RubyArray
.item
- an elementRubyArray
public RubyArray<E> push(E... items)
RubyArray
.items
- an array of elementRubyArray
public <S> RubyArray<S> rassoc(S target)
S
- the type of a Listtarget
- the last element of returned Listpublic RubyEnumerator<E> rejectǃ()
RubyEnumerator
of this RubyArray
.RubyEnumerator
public RubyArray<E> rejectǃ(BooleanBlock<? super E> block)
block
- to filter elementsRubyArray
public RubyEnumerator<RubyArray<E>> repeatedCombination(int n)
RubyArray
.n
- length of each repeated combinationRubyEnumerator
public RubyArray<E> repeatedCombination(int n, Block<? super RubyArray<E>> block)
RubyArray
and yield to the block.n
- length of each repeated combinationblock
- to yield each repeated combinationRubyArray
public RubyEnumerator<RubyArray<E>> repeatedPermutation(int n)
RubyArray
.n
- length of each repeated permutationRubyEnumerator
public RubyArray<E> repeatedPermutation(int n, Block<? super RubyArray<E>> block)
RubyArray
and yield to the block.n
- length of each repeated permutationblock
- to yield each repeated permutationRubyArray
public RubyArray<E> replace(java.util.Collection<? extends E> other)
other
- a CollectionRubyArray
public RubyEnumerator<E> rindex()
RubyEnumerator
of this RubyArray
reversed.RubyEnumerator
public java.lang.Integer rindex(BooleanBlock<? super E> block)
block
- to filter the elementpublic java.lang.Integer rindex(E target)
target
- to be foundpublic RubyArray<E> rotate()
RubyArray
.RubyArray
public RubyArray<E> rotate(int n)
n
- movesRubyArray
public RubyArray<E> rotateǃ(int n)
n
- times to perform the rotationsRubyArray
public E sample()
public RubyArray<E> sample(int n)
n
- number of elementsRubyArray
java.lang.IllegalArgumentException
- if n is less than 0public RubyEnumerator<E> selectǃ()
RubyEnumerator
of this RubyArray
.RubyEnumerator
public RubyArray<E> selectǃ(BooleanBlock<? super E> block)
block
- to filter elementsRubyArray
or nullpublic E shift()
public RubyArray<E> shift(int n)
n
- number of elementsRubyArray
java.lang.IllegalArgumentException
- if n is less than 0public E slice(int index)
at(int)
.index
- of an elementpublic E sliceǃ(int index)
RubyArray
.index
- of the elementpublic RubyArray<E> sliceǃ(int index, int length)
RubyArray
out of self.public RubyArray<E> sortǃ(java.util.Comparator<? super E> comp)
RubyArray
by given Comparator.comp
- a ComparatorRubyArray
public RubyEnumerator<E> sortByǃ()
RubyEnumerator
of this RubyArray
.RubyEnumerator
public <S> RubyArray<E> sortByǃ(java.util.Comparator<? super S> comp, TransformBlock<? super E,? extends S> block)
RubyArray
by the ordering of outputs
transformed by the block induced by the Comparator.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)
RubyArray
by the ordering of outputs
transformed by the block induced by the Comparator for S and applies the
Comparator for E again.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)
RubyArray
by the ordering of putputs
transformed by the block.S
- the type of transformed elementsblock
- to transform elementsRubyArray
public <S> RubyArray<E> sortByǃ(java.lang.String methodName, java.lang.Object... args)
RubyArray
by the ordering of outputs invoked
by given method name.methodName
- name of a Methodargs
- arguments of a MethodRubyArray
public RubyArray<E> minus(java.util.Collection<? extends E> other)
RubyArray
.other
- a CollectionRubyArray
public java.lang.String toS()
toString()
.public RubyArray<E> union(java.util.Collection<? extends E> other)
RubyArray
.other
- a CollectionRubyArray
public RubyArray<E> uniq()
RubyArray
.RubyArray
public <S> RubyArray<E> uniq(TransformBlock<? super E,? extends S> block)
RubyArray
.S
- the type of transformed elementsblock
- to transform elementsRubyArray
public <S> RubyArray<E> uniq(java.lang.String methodName, java.lang.Object... args)
RubyArray
.methodName
- name of a Methodargs
- arguments of a MethodRubyArray
public RubyArray<E> uniqǃ()
RubyArray
or nullpublic <S> RubyArray<E> uniqǃ(java.lang.String methodName, java.lang.Object... args)
RubyArray
.methodName
- name of a Methodargs
- arguments of a MethodRubyArray
or nullpublic <S> RubyArray<E> uniqǃ(TransformBlock<? super E,? extends S> block)
S
- the type of transformed elementsblock
- to transform elementsRubyArray
public RubyArray<E> unshift(E item)
RubyArray
item
- an elementRubyArray
public RubyArray<E> valuesAt(int... indices)
RubyArray
.indices
- where elements to be foundRubyArray
public RubyArray<E> valuesAt(java.lang.Iterable<java.lang.Integer> indices)
RubyArray
.indices
- where elements to be foundRubyArray
public int size()
public boolean isEmpty()
public boolean contains(java.lang.Object o)
public java.util.Iterator<E> iterator()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(E e)
public boolean remove(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean addAll(java.util.Collection<? extends E> c)
public boolean addAll(int index, java.util.Collection<? extends E> c)
addAll
in interface java.util.List<E>
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public void clear()
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<E>
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<E>
public java.util.ListIterator<E> listIterator()
listIterator
in interface java.util.List<E>
public java.util.ListIterator<E> listIterator(int index)
listIterator
in interface java.util.List<E>
public java.util.List<E> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<E>
public boolean equals(java.lang.Object o)
public int hashCode()
public java.lang.String toString()
toString
in class RubyEnumerable<E>