|
|||||||||
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<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 char s. |
|
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(Object other)
Test for equality with another object |
|
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 |
|
String |
toString()
Return a string representation of the array |
|
CharArray |
with(char newChar)
Creates a CharArray with an appended char . |
|
CharArray |
with(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 |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static CharArray array(char... chars)
char
s.
chars
- each elementpublic static CharArray array()
CharArray
public static CharArray array(char value)
CharArray
with one element.
value
- the valuepublic static CharArray array(char value1, char value2)
CharArray
with two elements.
value1
- the first valuevalue2
- the second valuepublic static CharArray array(char value1, char value2, char value3)
CharArray
with three elements.
value1
- the first valuevalue2
- the second valuevalue3
- the third valuepublic 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(Object other)
equals
in class ConstArray<Character>
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<Character>
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String toString()
toString
in class ConstArray<Character>
public int length()
length
in class ConstArray<Character>
public Character get(int i)
Character
for a specified char
.
get
in class ConstArray<Character>
i
- position of the element to return
ArrayIndexOutOfBoundsException
- i
is out of boundspublic <T> T[] toArray(T[] prototype)
toArray
in class ConstArray<Character>
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 CharArray with(Character newChar)
CharArray with an appended Character
.
- Overrides:
with
in class PowerlessArray<Character>
- Parameters:
newChar
- the element to append
- Returns:
- the new array
- Throws:
NullPointerException
- newChar
is null
public char getChar(int i)
char
at a specified position.
i
- position of the element to return
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<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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |