|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface LongList
Defines a list of primitive long values.
This interface extends List allowing seamless integration
with other APIs.
All List methods can be used, using the primitive wrapper class Long.
However, it will be much more efficient to use the methods defined here.
| Method Summary | |
|---|---|
boolean |
add(int index,
long value)
Adds a primitive value to this list at an index (optional operation). |
boolean |
addAll(int index,
long[] values)
Adds an array of primitive values to this list at an index (optional operation). |
long |
firstLong()
Gets the first primitive value. |
long |
getLong(int index)
Gets the primitive value at the specified index. |
int |
indexOf(long value)
Gets the first index of the specified primitive value. |
int |
indexOf(long value,
int fromIndexInclusive)
Gets the first index of the specified primitive value from an index. |
LongIterator |
iterator()
Gets an iterator over this list capable of accessing the primitive values. |
int |
lastIndexOf(long value)
Gets the last index of the specified primitive value. |
int |
lastIndexOf(long value,
int fromIndexInclusive)
Gets the first index of the specified primitive value from an index. |
long |
lastLong()
Gets the last primitive value. |
LongListIterator |
listIterator()
Gets a list iterator over this list capable of accessing the primitive values. |
LongListIterator |
listIterator(int index)
Gets a list iterator over this list from a start index capable of accessing the primitive values. |
Long |
remove(int index)
Deprecated. use long removeLongAt(int) |
long |
removeLongAt(int index)
Removes a primitive value by index from the list (optional operation). |
long |
set(int index,
long value)
Sets the primitive value at a specified index (optional operation). |
LongList |
subList(int fromIndexInclusive,
int toIndexExclusive)
Gets a range view of part of this list. |
long[] |
toLongArray(int fromIndexInclusive,
int toIndexExclusive)
Gets a range of elements as an array. |
| Methods inherited from interface org.joda.primitives.list.PrimitiveList |
|---|
first, last, removeRange |
| Methods inherited from interface org.joda.primitives.collection.PrimitiveCollection |
|---|
containsAny |
| Methods inherited from interface org.joda.primitives.PrimitiveCollectable |
|---|
clear, clone, isEmpty, isModifiable, optimize, size |
| Methods inherited from interface java.util.List |
|---|
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, lastIndexOf, remove, removeAll, retainAll, set, size, toArray, toArray |
| Methods inherited from interface org.joda.primitives.collection.LongCollection |
|---|
add, addAll, addAll, addAll, contains, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, toLongArray, toLongArray |
| Methods inherited from interface org.joda.primitives.collection.PrimitiveCollection |
|---|
containsAny |
| Methods inherited from interface org.joda.primitives.PrimitiveCollectable |
|---|
clear, clone, isEmpty, isModifiable, optimize, size |
| Method Detail |
|---|
LongIterator iterator()
iterator in interface Collection<Long>iterator in interface Iterable<Long>iterator in interface List<Long>iterator in interface LongCollectioniterator in interface LongIterablelong getLong(int index)
index - the index to get from
IndexOutOfBoundsException - if the index is invalidlong firstLong()
IndexOutOfBoundsException - if the size is zerolong lastLong()
size() - 1
IndexOutOfBoundsException - if the size is zeroLongListIterator listIterator()
listIterator in interface List<Long>LongListIterator listIterator(int index)
listIterator in interface List<Long>index - the index to start from
IndexOutOfBoundsException - if the index is invalidint indexOf(long value)
value - the value to search for
-1 if not found
int indexOf(long value,
int fromIndexInclusive)
This method follows the conventions of String in that a
negative index is treated as zero, and an index greater than the list
size will simply return -1.
value - the value to search forfromIndexInclusive - the index to start searching from, inclusive
-1 if not foundint lastIndexOf(long value)
value - the value to search for
-1 if not found
int lastIndexOf(long value,
int fromIndexInclusive)
This method follows the conventions of String in that an
index greater than the list size will start searching at the list size,
and a negative index simply returns -1.
value - the value to search forfromIndexInclusive - the index to start searching from, inclusive
-1 if not found
long[] toLongArray(int fromIndexInclusive,
int toIndexExclusive)
fromIndexInclusive - the index to start from, inclusivetoIndexExclusive - the index to end at, exclusive
IndexOutOfBoundsException - if either index is invalid
LongList subList(int fromIndexInclusive,
int toIndexExclusive)
This method allows operations to work on a range within the greater list. Changes made to the either object will affect the other.
subList in interface List<Long>fromIndexInclusive - the index to start from, inclusivetoIndexExclusive - the index to end at, exclusive
IndexOutOfBoundsException - if either index is invalid
boolean add(int index,
long value)
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
index - the index to add atvalue - the value to add to this collection
true if this list was modified by this method call
IndexOutOfBoundsException - if the index is invalid
IllegalArgumentException - if value is rejected by this collection
UnsupportedOperationException - if not supported by this collection
boolean addAll(int index,
long[] values)
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
index - the index to add atvalues - the values to add to this collection, null treated as empty array
true if this list was modified by this method call
IndexOutOfBoundsException - if the index is invalid
IllegalArgumentException - if value is rejected by this collection
UnsupportedOperationException - if not supported by this collection@Deprecated Long remove(int index)
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
This method is deprecated to serve as a warning to developers.
Using it can be confusing as it removes by index rather than by primitive.
The method will still function correctly as the method is defined in the List interface.
Use removeLongAt(int) instead.
remove in interface List<Long>index - the index to remove from
IndexOutOfBoundsException - if the index is invalid
UnsupportedOperationException - if not supported by this collectionlong removeLongAt(int index)
This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.
index - the index to remove from
IndexOutOfBoundsException - if the index is invalid
UnsupportedOperationException - if not supported by this collection
long set(int index,
long value)
This method is optional, throwing an UnsupportedOperationException if the collection cannot be changed.
index - the index to setvalue - the value to store
IndexOutOfBoundsException - if the index is invalid
IllegalArgumentException - if value is rejected by this collection
UnsupportedOperationException - if not supported by this collection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||