jsat.utils
Class LongList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<java.lang.Long>
-
- jsat.utils.LongList
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Iterable<java.lang.Long>, java.util.Collection<java.lang.Long>, java.util.List<java.lang.Long>
public class LongList extends java.util.AbstractList<java.lang.Long> implements java.io.SerializableProvides a modifiable implementation of a List using an array of longs. This provides considerable memory efficency improvements over using anArrayListto store longs. Null is not allowed into the list.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description LongList()Creates a new LongListLongList(java.util.Collection<java.lang.Long> c)LongList(int capacity)Creates a new LongList with the given initial capacity
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(int index, long element)Operates exactly asadd(int, java.lang.Long)voidadd(int index, java.lang.Long element)booleanadd(long e)Operates exactly asadd(java.lang.Long)booleanadd(java.lang.Long e)voidclear()java.lang.Longget(int index)longgetL(int index)Operates exactly asget(int)java.lang.Longremove(int index)longset(int index, long element)Operates exactly asset(int, java.lang.Long)java.lang.Longset(int index, java.lang.Long element)intsize()static java.util.List<java.lang.Long>view(long[] array, int length)Creates and returns a view of the given long array that requires only a small object allocation.-
Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
LongList
public LongList()
Creates a new LongList
-
LongList
public LongList(int capacity)
Creates a new LongList with the given initial capacity- Parameters:
capacity- the starting internal storage space size
-
LongList
public LongList(java.util.Collection<java.lang.Long> c)
-
-
Method Detail
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<java.lang.Long>- Specified by:
clearin interfacejava.util.List<java.lang.Long>- Overrides:
clearin classjava.util.AbstractList<java.lang.Long>
-
set
public long set(int index, long element)Operates exactly asset(int, java.lang.Long)- Parameters:
index- the index to setelement- the value to set- Returns:
- the previous value at the index
-
set
public java.lang.Long set(int index, java.lang.Long element)- Specified by:
setin interfacejava.util.List<java.lang.Long>- Overrides:
setin classjava.util.AbstractList<java.lang.Long>
-
add
public void add(int index, long element)Operates exactly asadd(int, java.lang.Long)- Parameters:
index- the index to add the value intoelement- the value to add
-
add
public void add(int index, java.lang.Long element)- Specified by:
addin interfacejava.util.List<java.lang.Long>- Overrides:
addin classjava.util.AbstractList<java.lang.Long>
-
add
public boolean add(long e)
Operates exactly asadd(java.lang.Long)- Parameters:
e- the value to add- Returns:
- true if it was added, false otherwise
-
add
public boolean add(java.lang.Long e)
- Specified by:
addin interfacejava.util.Collection<java.lang.Long>- Specified by:
addin interfacejava.util.List<java.lang.Long>- Overrides:
addin classjava.util.AbstractList<java.lang.Long>
-
getL
public long getL(int index)
Operates exactly asget(int)- Parameters:
index- the index of the value to get- Returns:
- the value at the index
-
get
public java.lang.Long get(int index)
- Specified by:
getin interfacejava.util.List<java.lang.Long>- Specified by:
getin classjava.util.AbstractList<java.lang.Long>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<java.lang.Long>- Specified by:
sizein interfacejava.util.List<java.lang.Long>- Specified by:
sizein classjava.util.AbstractCollection<java.lang.Long>
-
remove
public java.lang.Long remove(int index)
- Specified by:
removein interfacejava.util.List<java.lang.Long>- Overrides:
removein classjava.util.AbstractList<java.lang.Long>
-
view
public static java.util.List<java.lang.Long> view(long[] array, int length)Creates and returns a view of the given long array that requires only a small object allocation.- Parameters:
array- the array to wrap into a listlength- the number of values of the array to use, starting from zero- Returns:
- a list view of the array
-
-
DataMelt 3.0 © DataMelt by jWork.ORG