|
ref_send API 2.17 defensive programming in Java |
|||||||||
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<java.lang.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(java.lang.Object other)
Test for equality with another object |
|
java.lang.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 |
|
java.lang.String |
toString()
Return a string representation of the array |
|
LongArray |
with(long newLong)
Creates a LongArray with an appended long . |
|
LongArray |
with(java.lang.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 |
---|
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(java.lang.Object other)
equals
in class ImmutableArray<java.lang.Long>
ConstArray
with the same
contents as this arraypublic int hashCode()
Arrays.hashCode(Object[])
called on a Java array
containing the same elements.
hashCode
in interface Selfless
hashCode
in class ConstArray<java.lang.Long>
public java.lang.String toString()
toString
in class ConstArray<java.lang.Long>
public int length()
length
in class ConstArray<java.lang.Long>
public java.lang.Long get(int i)
Long
for a specified long
.
get
in class ConstArray<java.lang.Long>
i
- position of the element to return
java.lang.ArrayIndexOutOfBoundsException
- i
is out of boundspublic <T> T[] toArray(T[] prototype)
toArray
in class ConstArray<java.lang.Long>
prototype
- prototype of the array to copy into
ConstArray
of the same type as prototype
java.lang.ArrayStoreException
- if an element cannot be stored in the arraypublic LongArray with(java.lang.Long newLong)
LongArray with an appended Long
.
- Overrides:
with
in class PowerlessArray<java.lang.Long>
- Parameters:
newLong
- the element to append
- Returns:
- the new array
- Throws:
java.lang.NullPointerException
- newLong
is null
public long getLong(int i)
long
at a specified position.
i
- position of the element to return
java.lang.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<java.lang.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
|
ref_send API 2.17 defensive programming in Java |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.