|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.joe_e.array.ConstArray<E> org.joe_e.array.ImmutableArray<E> org.joe_e.array.PowerlessArray<Long> org.joe_e.array.LongArray
public final class LongArray
An immutable array of long
.
Nested Class Summary | |
---|---|
static class |
LongArray.Builder
A LongArray factory. |
Method Summary | ||
---|---|---|
static LongArray |
array()
Construct an empty LongArray |
|
static LongArray |
array(long... longs)
Constructs an array of long s. |
|
static LongArray |
array(long value)
Construct a LongArray with one element. |
|
static LongArray |
array(long value1,
long value2)
Construct a LongArray with two elements. |
|
static LongArray |
array(long value1,
long value2,
long value3)
Construct a LongArray with three elements. |
|
static LongArray |
array(long value1,
long value2,
long value3,
long value4)
Construct a LongArray with four elements. |
|
static LongArray.Builder |
builder()
Get a LongArray.Builder . |
|
static LongArray.Builder |
builder(int estimate)
Get a LongArray.Builder . |
|
boolean |
equals(Object other)
Test for equality with another object |
|
Long |
get(int i)
Creates a Long for a specified long . |
|
long |
getLong(int i)
Gets the long at a specified position. |
|
int |
hashCode()
Computes a digest of the array for hashing. |
|
int |
length()
Gets the length of the array. |
|
|
toArray(T[] prototype)
Return a mutable copy of the array |
|
long[] |
toLongArray()
Creates a mutable copy of the long array |
|
String |
toString()
Return a string representation of the array |
|
LongArray |
with(long newLong)
Creates a LongArray with an appended long . |
|
LongArray |
with(Long newLong)
Creates a LongArray |
|
LongArray |
without(int i)
Return a new LongArray that contains the same elements
as this one excluding the element at a specified index |
Methods inherited from class org.joe_e.array.PowerlessArray |
---|
array |
Methods inherited from class org.joe_e.array.ConstArray |
---|
iterator |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static LongArray array(long... longs)
long
s.
longs
- each elementpublic static LongArray array()
LongArray
public static LongArray array(long value)
LongArray
with one element.
value
- the valuepublic static LongArray array(long value1, long value2)
LongArray
with two elements.
value1
- the first valuevalue2
- the second valuepublic static LongArray array(long value1, long value2, long value3)
LongArray
with three elements.
value1
- the first valuevalue2
- the second valuevalue3
- the third valuepublic static LongArray array(long value1, long value2, long value3, long value4)
LongArray
with four elements.
value1
- the first valuevalue2
- the second valuevalue3
- the third valuevalue4
- the fourth valuepublic boolean equals(Object other)
equals
in class ConstArray<Long>
other
- the reference object with which to compare.
ConstArray
with the same
contents as this arrayObject.hashCode()
,
HashMap
public int hashCode()
Arrays.hashCode(Object[])
called on a Java array
containing the same elements.
hashCode
in interface Selfless
hashCode
in class ConstArray<Long>
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String toString()
toString
in class ConstArray<Long>
public int length()
length
in class ConstArray<Long>
public Long get(int i)
Long
for a specified long
.
get
in class ConstArray<Long>
i
- position of the element to return
ArrayIndexOutOfBoundsException
- i
is out of boundspublic <T> T[] toArray(T[] prototype)
toArray
in class ConstArray<Long>
prototype
- prototype of the array to copy into
ConstArray
of the same type as prototype
ArrayStoreException
- if an element cannot be stored in the arraypublic LongArray with(Long newLong)
LongArray with an appended Long
.
- Overrides:
with
in class PowerlessArray<Long>
- Parameters:
newLong
- the element to append
- Returns:
- the new array
- Throws:
NullPointerException
- newLong
is null
public long getLong(int i)
long
at a specified position.
i
- position of the element to return
ArrayIndexOutOfBoundsException
- i
is out of boundspublic long[] toLongArray()
long
array
public LongArray with(long newLong)
LongArray
with an appended long
.
newLong
- the element to appendpublic LongArray without(int i)
LongArray
that contains the same elements
as this one excluding the element at a specified index
without
in class PowerlessArray<Long>
i
- the index of the element to exclude
public static LongArray.Builder builder()
LongArray.Builder
. This is equivalent to the
constructor.
public static LongArray.Builder builder(int estimate)
LongArray.Builder
. This is equivalent to the
constructor.
estimate
- estimated array length
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |