public class JreArrayOfInt extends Object implements ArrayOfInt
Constructor and Description |
---|
JreArrayOfInt() |
Modifier and Type | Method and Description |
---|---|
ArrayOfInt |
concat(ArrayOfInt values)
Returns a new array that is the concatenation of this array and
values . |
boolean |
contains(int value)
Indicates whether the array contains the specified value.
|
int |
get(int index)
Gets the value at a given index.
|
int |
indexOf(int value)
Returns the index of the specified value or
-1 if the value is
not found. |
void |
insert(int index,
int value)
Inserts a new element into the array at the specified index.
|
boolean |
isEmpty()
Returns true if the length of the array is zero.
|
boolean |
isSet(int index)
Check that the specified
index has been initialized to a valid
value. |
String |
join()
Convert each element of the array to a String and join them with a comma
separator.
|
String |
join(String separator)
Convert each element of the array to a String and join them with a comma
separator.
|
int |
length()
Gets the length of the array.
|
int |
peek()
Returns the last value of the array;
|
int |
pop()
Remove and return the element from the end of the array.
|
void |
push(int value)
Pushes the given integer onto the end of the array.
|
void |
remove(int value)
Searches for the specified value in the array and removes the first
occurrence if found.
|
void |
removeByIndex(int index)
Removes the element at the specified index.
|
void |
set(int index,
int value)
Sets the value value at a given index.
|
void |
setLength(int length)
Reset the length of the array.
|
int |
shift()
Shifts the first value off the array.
|
void |
sort()
Sorts the contents of the array in ascending order.
|
void |
sort(CanCompareInt comparator)
Sorts the contents of the Array based on the
CanCompareInt . |
ArrayOfInt |
splice(int index,
int count)
Removes the specified number of elements starting at index and returns the
removed elements.
|
void |
unshift(int value)
Shifts a value onto the beginning of the array.
|
public ArrayOfInt concat(ArrayOfInt values)
ArrayOfInt
values
. This method does not mutate the current array.concat
in interface ArrayOfInt
public boolean contains(int value)
ArrayOfInt
contains
in interface ArrayOfInt
public int get(int index)
ArrayOfInt
get
in interface ArrayOfInt
index
- the index to be retrievedpublic int indexOf(int value)
ArrayOfInt
-1
if the value is
not found.indexOf
in interface ArrayOfInt
public void insert(int index, int value)
ArrayOfInt
insert
in interface ArrayOfInt
public boolean isEmpty()
ArrayOfInt
isEmpty
in interface ArrayOfInt
public boolean isSet(int index)
ArrayOfInt
index
has been initialized to a valid
value.isSet
in interface ArrayOfInt
public String join()
ArrayOfInt
join
in interface ArrayOfInt
public String join(String separator)
ArrayOfInt
join
in interface ArrayOfInt
public int length()
ArrayOfInt
length
in interface ArrayOfInt
public int peek()
ArrayOfInt
peek
in interface ArrayOfInt
public int pop()
ArrayOfInt
pop
in interface ArrayOfInt
public void push(int value)
ArrayOfInt
push
in interface ArrayOfInt
public void remove(int value)
ArrayOfInt
remove
in interface ArrayOfInt
public void removeByIndex(int index)
ArrayOfInt
removeByIndex
in interface ArrayOfInt
public void set(int index, int value)
ArrayOfInt
set
in interface ArrayOfInt
index
- the index to be setvalue
- the value to be storedpublic void setLength(int length)
ArrayOfInt
setLength
in interface ArrayOfInt
length
- the new length of the arraypublic int shift()
ArrayOfInt
shift
in interface ArrayOfInt
public void sort()
ArrayOfInt
sort
in interface ArrayOfInt
public void sort(CanCompareInt comparator)
ArrayOfInt
CanCompareInt
.sort
in interface ArrayOfInt
public ArrayOfInt splice(int index, int count)
ArrayOfInt
splice
in interface ArrayOfInt
public void unshift(int value)
ArrayOfInt
unshift
in interface ArrayOfInt
value
- the value to the storedCopyright © 2016. All rights reserved.