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