T
- Value key type@Immutable @Loggable(value=1) public final class Array<T> extends Object implements List<T>
This class is truly immutable. This means that it never changes
its encapsulated values and is annotated with @Immutable
annotation.
Constructor and Description |
---|
Array()
Public ctor, for an zero-length empty array.
|
Array(Iterable<T> list)
Public ctor.
|
Array(T... list)
Public ctor, from an array of values.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element) |
boolean |
add(T element) |
boolean |
addAll(Collection<? extends T> col) |
boolean |
addAll(int index,
Collection<? extends T> col) |
void |
clear() |
boolean |
contains(Object key) |
boolean |
containsAll(Collection<?> col) |
boolean |
equals(Object object) |
T |
get(int index) |
int |
hashCode() |
int |
indexOf(Object obj) |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
int |
lastIndexOf(Object obj) |
Array<T> |
less(T item)
Make a new array, without this element (or the same array if such
an element is absent).
|
ListIterator<T> |
listIterator() |
ListIterator<T> |
listIterator(int index) |
T |
remove(int index) |
boolean |
remove(Object obj) |
boolean |
removeAll(Collection<?> col) |
boolean |
retainAll(Collection<?> col) |
T |
set(int index,
T element) |
int |
size() |
List<T> |
subList(int from,
int till) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] array) |
String |
toString() |
Array<T> |
with(int pos,
T value)
Make a new one with an extra entry at the given position.
|
Array<T> |
with(Iterable<T> vals)
Make a new extra entries, at the end of array.
|
Array<T> |
with(T value)
Make a new one with an extra entry, at the end of array (will be
extended by one extra element).
|
Array<T> |
without(int idx)
Make a new array, without this element.
|
public Array()
public Array(T... list)
list
- Items to encapsulatepublic Array<T> with(T value)
value
- The valuepublic Array<T> with(Iterable<T> vals)
vals
- The valuespublic Array<T> with(int pos, T value)
pos
- Position to replacevalue
- The valuepublic Array<T> without(int idx)
The method throws ArrayIndexOutOfBoundsException
if such
position is absent in the array.
idx
- The position to removepublic Array<T> less(T item)
item
- The element to removepublic int hashCode()
public boolean equals(Object object)
public int size()
public boolean isEmpty()
public boolean contains(Object key)
public Object[] toArray()
public <T> T[] toArray(T[] array)
public boolean add(T element)
public boolean remove(Object obj)
public boolean containsAll(Collection<?> col)
containsAll
in interface Collection<T>
containsAll
in interface List<T>
public boolean addAll(Collection<? extends T> col)
public boolean retainAll(Collection<?> col)
public boolean removeAll(Collection<?> col)
public void clear()
public boolean addAll(int index, Collection<? extends T> col)
public int lastIndexOf(Object obj)
lastIndexOf
in interface List<T>
public ListIterator<T> listIterator()
listIterator
in interface List<T>
public ListIterator<T> listIterator(int index)
listIterator
in interface List<T>
Copyright © 2012–2014 jcabi.com. All rights reserved.