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