TYPE
- Type of the element in the arraypublic class ListFromArray<TYPE>
extends java.lang.Object
implements java.util.List<TYPE>
Modifier and Type | Field and Description |
---|---|
private TYPE[] |
array
Linked array
|
private int |
length
Array length
|
private boolean |
modifiable
Indicates if modify an element is allowed
|
Constructor and Description |
---|
ListFromArray(boolean modifiable,
TYPE... array)
Create a new instance of ListFromArray
|
ListFromArray(TYPE... array)
Create a new instance of ListFromArray
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
TYPE element)
Not permitted operation.
|
boolean |
add(TYPE e)
Not permitted operation.
|
boolean |
addAll(java.util.Collection<? extends TYPE> c)
Not permitted operation.
|
boolean |
addAll(int index,
java.util.Collection<? extends TYPE> c)
Not permitted operation.
|
private void |
checkIndex(int index)
Check if an index is inside the array
|
void |
clear()
Not permitted operation.
|
boolean |
contains(java.lang.Object o)
Indicates if an element is inside the list
Parent documentation: |
boolean |
containsAll(java.util.Collection<?> c)
Indicates if all elements of a collection is inside the list
Parent documentation: |
TYPE |
get(int index)
Obtain an element from the list
Parent documentation: |
int |
indexOf(java.lang.Object o)
Compute index of an element
Parent documentation: |
boolean |
isEmpty()
Indicates if list is empty
Parent documentation: |
boolean |
isModifiable()
Indicates if it is allowed to modify elements inside the list throw
set(int, Object) method |
java.util.Iterator<TYPE> |
iterator()
Create iterator over the list
Parent documentation: |
int |
lastIndexOf(java.lang.Object o)
Compute index, form the end, that corresponds to a specific object
Parent documentation: |
java.util.ListIterator<TYPE> |
listIterator()
Create list iterator over the list
Parent documentation: |
java.util.ListIterator<TYPE> |
listIterator(int index)
Create list iterator that start to a given index
Parent documentation: |
TYPE |
remove(int index)
Not permitted operation.
|
boolean |
remove(java.lang.Object o)
Not permitted operation.
|
boolean |
removeAll(java.util.Collection<?> c)
Not permitted operation.
|
boolean |
retainAll(java.util.Collection<?> c)
Not permitted operation.
|
TYPE |
set(int index,
TYPE element)
Modify a element of the list.
|
int |
size()
List size
Parent documentation: |
java.util.List<TYPE> |
subList(int fromIndex,
int toIndex)
Extract a sub list from the list
Parent documentation: |
java.lang.Object[] |
toArray()
Convert list to array
Parent documentation: |
<T> T[] |
toArray(T[] a)
Convert list to array
Parent documentation: |
private final TYPE[] array
private final int length
private final boolean modifiable
public ListFromArray(boolean modifiable, TYPE... array)
modifiable
- Indicates if modify an element is allowedarray
- Array to link to the listpublic ListFromArray(TYPE... array)
array
- Array to link to the listprivate void checkIndex(int index)
index
- Index to checkpublic void add(int index, TYPE element)
UnsupportedOperationException
add
in interface java.util.List<TYPE>
index
- Ignoredelement
- IgnoredList.add(int, java.lang.Object)
public boolean add(TYPE e)
UnsupportedOperationException
public boolean addAll(java.util.Collection<? extends TYPE> c)
UnsupportedOperationException
public boolean addAll(int index, java.util.Collection<? extends TYPE> c)
UnsupportedOperationException
addAll
in interface java.util.List<TYPE>
index
- Ignoredc
- IgnoredList.addAll(int, java.util.Collection)
public void clear()
UnsupportedOperationException
public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public TYPE get(int index)
get
in interface java.util.List<TYPE>
index
- Element indexList.get(int)
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<TYPE>
o
- Element searchList.indexOf(java.lang.Object)
public boolean isEmpty()
public boolean isModifiable()
set(int, Object)
methodtrue
if modification are allowedpublic java.util.Iterator<TYPE> iterator()
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<TYPE>
o
- Object searchList.lastIndexOf(java.lang.Object)
public java.util.ListIterator<TYPE> listIterator()
listIterator
in interface java.util.List<TYPE>
List.listIterator()
public java.util.ListIterator<TYPE> listIterator(int index)
listIterator
in interface java.util.List<TYPE>
index
- Index to startList.listIterator(int)
public TYPE remove(int index)
UnsupportedOperationException
remove
in interface java.util.List<TYPE>
index
- IgnoredList.remove(int)
public boolean remove(java.lang.Object o)
UnsupportedOperationException
public boolean removeAll(java.util.Collection<?> c)
UnsupportedOperationException
public boolean retainAll(java.util.Collection<?> c)
UnsupportedOperationException
public TYPE set(int index, TYPE element)
UnsupportedOperationException
if the list is not modifiable set
in interface java.util.List<TYPE>
index
- Index of element to changeelement
- New valueList.set(int, java.lang.Object)
public int size()
public java.util.List<TYPE> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<TYPE>
fromIndex
- Start indextoIndex
- End indexList.subList(int, int)
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)