Package org.nd4j.list
Class NDArrayList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<X>
-
- org.nd4j.list.BaseNDArrayList<Double>
-
- org.nd4j.list.NDArrayList
-
public class NDArrayList extends BaseNDArrayList<Double>
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description NDArrayList()
NDArrayList(int size)
Initialize with the desired size.NDArrayList(@NonNull INDArray container)
Specify the underlying ndarray for this list.NDArrayList(@NonNull INDArray container, int size)
Specify the underlying ndarray for this list.NDArrayList(DataType dataType, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int i, Double aDouble)
boolean
add(Double aDouble)
boolean
addAll(int i, Collection<? extends Double> collection)
boolean
addAll(Collection<? extends Double> collection)
INDArray
array()
Get a view of the underlying array relative to the size of the actual array.void
clear()
boolean
contains(Object o)
boolean
containsAll(Collection<?> collection)
Double
get(int i)
int
indexOf(Object o)
boolean
isEmpty()
Iterator<Double>
iterator()
int
lastIndexOf(Object o)
ListIterator<Double>
listIterator()
ListIterator<Double>
listIterator(int i)
Double
remove(int i)
boolean
remove(Object o)
boolean
removeAll(Collection<?> collection)
boolean
retainAll(Collection<?> collection)
Double
set(int i, Double aDouble)
int
size()
List<Double>
subList(int i, int i1)
Object[]
toArray()
<T> T[]
toArray(T[] ts)
String
toString()
-
Methods inherited from class java.util.AbstractList
equals, hashCode, removeRange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
-
-
-
Constructor Detail
-
NDArrayList
public NDArrayList(int size)
Initialize with the desired size. This will set the list.size() to be equal to the passed in size- Parameters:
size
- the initial size of the array
-
NDArrayList
public NDArrayList(DataType dataType, int size)
-
NDArrayList
public NDArrayList(@NonNull @NonNull INDArray container, int size)
Specify the underlying ndarray for this list.- Parameters:
container
- the underlying array.size
- the initial size of the array. This will set list.size() to be equal to the passed in size.
-
NDArrayList
public NDArrayList()
-
NDArrayList
public NDArrayList(@NonNull @NonNull INDArray container)
Specify the underlying ndarray for this list.- Parameters:
container
- the underlying array.
-
-
Method Detail
-
array
public INDArray array()
Get a view of the underlying array relative to the size of the actual array. (Sometimes there are overflows in the internals but you want to use the internal INDArray for computing something directly, this gives you the relevant subset that reflects the content of the list)- Overrides:
array
in classBaseNDArrayList<Double>
- Returns:
- the view of the underlying ndarray relative to the collection's real size
-
size
public int size()
- Specified by:
size
in interfaceCollection<Double>
- Specified by:
size
in interfaceList<Double>
- Overrides:
size
in classBaseNDArrayList<Double>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<Double>
- Specified by:
isEmpty
in interfaceList<Double>
- Overrides:
isEmpty
in classBaseNDArrayList<Double>
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<Double>
- Specified by:
contains
in interfaceList<Double>
- Overrides:
contains
in classBaseNDArrayList<Double>
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<Double>
- Specified by:
toArray
in interfaceList<Double>
- Overrides:
toArray
in classBaseNDArrayList<Double>
-
toArray
public <T> T[] toArray(T[] ts)
- Specified by:
toArray
in interfaceCollection<Double>
- Specified by:
toArray
in interfaceList<Double>
- Overrides:
toArray
in classBaseNDArrayList<Double>
-
add
public boolean add(Double aDouble)
- Specified by:
add
in interfaceCollection<Double>
- Specified by:
add
in interfaceList<Double>
- Overrides:
add
in classBaseNDArrayList<Double>
-
remove
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<Double>
- Specified by:
remove
in interfaceList<Double>
- Overrides:
remove
in classBaseNDArrayList<Double>
-
containsAll
public boolean containsAll(Collection<?> collection)
- Specified by:
containsAll
in interfaceCollection<Double>
- Specified by:
containsAll
in interfaceList<Double>
- Overrides:
containsAll
in classBaseNDArrayList<Double>
-
addAll
public boolean addAll(Collection<? extends Double> collection)
- Specified by:
addAll
in interfaceCollection<Double>
- Specified by:
addAll
in interfaceList<Double>
- Overrides:
addAll
in classBaseNDArrayList<Double>
-
addAll
public boolean addAll(int i, Collection<? extends Double> collection)
-
removeAll
public boolean removeAll(Collection<?> collection)
- Specified by:
removeAll
in interfaceCollection<Double>
- Specified by:
removeAll
in interfaceList<Double>
- Overrides:
removeAll
in classBaseNDArrayList<Double>
-
retainAll
public boolean retainAll(Collection<?> collection)
- Specified by:
retainAll
in interfaceCollection<Double>
- Specified by:
retainAll
in interfaceList<Double>
- Overrides:
retainAll
in classBaseNDArrayList<Double>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<Double>
- Specified by:
clear
in interfaceList<Double>
- Overrides:
clear
in classBaseNDArrayList<Double>
-
get
public Double get(int i)
-
add
public void add(int i, Double aDouble)
-
remove
public Double remove(int i)
-
indexOf
public int indexOf(Object o)
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOf
in interfaceList<Double>
- Overrides:
lastIndexOf
in classBaseNDArrayList<Double>
-
listIterator
public ListIterator<Double> listIterator()
- Specified by:
listIterator
in interfaceList<Double>
- Overrides:
listIterator
in classBaseNDArrayList<Double>
-
listIterator
public ListIterator<Double> listIterator(int i)
- Specified by:
listIterator
in interfaceList<Double>
- Overrides:
listIterator
in classBaseNDArrayList<Double>
-
toString
public String toString()
- Overrides:
toString
in classBaseNDArrayList<Double>
-
-