|
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.Double> org.joe_e.array.DoubleArray
public final class DoubleArray
An immutable array of double
.
Nested Class Summary | |
---|---|
static class |
DoubleArray.Builder
A DoubleArray factory. |
Method Summary | ||
---|---|---|
static DoubleArray |
array()
Construct an empty DoubleArray |
|
static DoubleArray |
array(double... doubles)
Constructs an array of double s. |
|
static DoubleArray |
array(double value)
Construct a DoubleArray with one element. |
|
static DoubleArray |
array(double value1,
double value2)
Construct a DoubleArray with two elements. |
|
static DoubleArray |
array(double value1,
double value2,
double value3)
Construct a DoubleArray with three elements. |
|
static DoubleArray |
array(double value1,
double value2,
double value3,
double value4)
Construct a DoubleArray with four elements. |
|
static DoubleArray.Builder |
builder()
Get a DoubleArray.Builder . |
|
static DoubleArray.Builder |
builder(int estimate)
Get a DoubleArray.Builder . |
|
boolean |
equals(java.lang.Object other)
Test for equality with another object |
|
java.lang.Double |
get(int i)
Creates a Double for a specified double . |
|
double |
getDouble(int i)
Gets the double 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 |
|
double[] |
toDoubleArray()
Creates a mutable copy of the double array |
|
java.lang.String |
toString()
Return a string representation of the array |
|
DoubleArray |
with(double newDouble)
Creates a DoubleArray with an appended double . |
|
DoubleArray |
with(java.lang.Double newDouble)
Creates a DoubleArray |
|
DoubleArray |
without(int i)
Return a new DoubleArray 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 DoubleArray array(double... doubles)
double
s.
doubles
- each elementpublic static DoubleArray array()
DoubleArray
public static DoubleArray array(double value)
DoubleArray
with one element.
value
- the valuepublic static DoubleArray array(double value1, double value2)
DoubleArray
with two elements.
value1
- the first valuevalue2
- the second valuepublic static DoubleArray array(double value1, double value2, double value3)
DoubleArray
with three elements.
value1
- the first valuevalue2
- the second valuevalue3
- the third valuepublic static DoubleArray array(double value1, double value2, double value3, double value4)
DoubleArray
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.Double>
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.Double>
public java.lang.String toString()
toString
in class ConstArray<java.lang.Double>
public int length()
length
in class ConstArray<java.lang.Double>
public java.lang.Double get(int i)
Double
for a specified double
.
get
in class ConstArray<java.lang.Double>
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.Double>
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 DoubleArray with(java.lang.Double newDouble)
DoubleArray with an appended Double
.
- Overrides:
with
in class PowerlessArray<java.lang.Double>
- Parameters:
newDouble
- the element to append
- Returns:
- the new array
- Throws:
java.lang.NullPointerException
- newDouble
is null
public double getDouble(int i)
double
at a specified position.
i
- position of the element to return
java.lang.ArrayIndexOutOfBoundsException
- i
is out of boundspublic double[] toDoubleArray()
double
array
public DoubleArray with(double newDouble)
DoubleArray
with an appended double
.
newDouble
- the element to appendpublic DoubleArray without(int i)
DoubleArray
that contains the same elements
as this one excluding the element at a specified index
without
in class PowerlessArray<java.lang.Double>
i
- the index of the element to exclude
public static DoubleArray.Builder builder()
DoubleArray.Builder
. This is equivalent to the
constructor.
public static DoubleArray.Builder builder(int estimate)
DoubleArray.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.