public class JreArrayOfString extends Object implements ArrayOfString
Constructor and Description |
---|
JreArrayOfString() |
JreArrayOfString(ArrayList<String> array) |
Modifier and Type | Method and Description |
---|---|
ArrayOfString |
concat(ArrayOfString values)
Returns a new array that is the concatenation of this array and
values . |
boolean |
contains(String value)
Indicates whether the array contains the specified value.
|
String |
get(int index)
Gets the value at a given index.
|
int |
indexOf(String value)
Returns the index of the specified value or
-1 if the value is
not found. |
void |
insert(int index,
String value)
Inserts a new element into the array at the specified index.
|
boolean |
isEmpty()
Returns true if the length of the array is zero.
|
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.
|
String |
peek()
Returns the last value of the array;
|
String |
pop()
Remove and return the element from the end of the array.
|
void |
push(String value)
Pushes the given value onto the end of the array.
|
void |
remove(String 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,
String value)
Sets the value value at a given index.
|
void |
setLength(int length)
Reset the length of the array.
|
String |
shift()
Shifts the first value off the array.
|
void |
sort()
Sorts the contents of the array in ascending order.
|
void |
sort(CanCompareString comparator)
Sorts the contents of the Array based on the
CanCompareString . |
ArrayOfString |
splice(int index,
int count)
Removes the specified number of elements starting at index and returns the
removed elements.
|
void |
unshift(String value)
Shifts a value onto the beginning of the array.
|
public ArrayOfString concat(ArrayOfString values)
ArrayOfString
values
. This method does not mutate the current array.concat
in interface ArrayOfString
public boolean contains(String value)
ArrayOfString
contains
in interface ArrayOfString
public String get(int index)
ArrayOfString
get
in interface ArrayOfString
index
- the index to be retrievednull
if none existspublic int indexOf(String value)
ArrayOfString
-1
if the value is
not found.indexOf
in interface ArrayOfString
public void insert(int index, String value)
ArrayOfString
insert
in interface ArrayOfString
public boolean isEmpty()
ArrayOfString
isEmpty
in interface ArrayOfString
public String join()
ArrayOfString
join
in interface ArrayOfString
public String join(String separator)
ArrayOfString
join
in interface ArrayOfString
public int length()
ArrayOfString
length
in interface ArrayOfString
public String peek()
ArrayOfString
peek
in interface ArrayOfString
public String pop()
ArrayOfString
pop
in interface ArrayOfString
public void push(String value)
ArrayOfString
push
in interface ArrayOfString
public void remove(String value)
ArrayOfString
remove
in interface ArrayOfString
public void removeByIndex(int index)
ArrayOfString
removeByIndex
in interface ArrayOfString
public void set(int index, String value)
ArrayOfString
set
in interface ArrayOfString
index
- the index to be setvalue
- the value to be storedpublic void setLength(int length)
ArrayOfString
setLength
in interface ArrayOfString
length
- the new length of the arraypublic String shift()
ArrayOfString
shift
in interface ArrayOfString
public void sort()
ArrayOfString
sort
in interface ArrayOfString
public void sort(CanCompareString comparator)
ArrayOfString
CanCompareString
.sort
in interface ArrayOfString
public ArrayOfString splice(int index, int count)
ArrayOfString
splice
in interface ArrayOfString
public void unshift(String value)
ArrayOfString
unshift
in interface ArrayOfString
value
- the value to the storedCopyright © 2018. All rights reserved.