| JGL - The Generic Collection Library for Java |
All Packages Class Hierarchy This Package Previous Next Index
Class com.objectspace.jgl.adapters.CharArray
java.lang.Object
|
+----com.objectspace.jgl.adapters.ArrayAdapter
|
+----com.objectspace.jgl.adapters.CharArray
- public class CharArray
- extends ArrayAdapter
CharArray allows a native array of chars to be accessed like a JGL
Container. It is particularly useful for applying generic algorithms
such as Sorting.sort() to a native array.
-
CharArray()
- Construct myself to refer to an empty array.
-
CharArray(char[])
- Construct myself to refer to a native Java array.
-
CharArray(CharArray)
- Construct myself to refer to an existing CharArray.
-
CharArray(CharBuffer)
- Construct myself to be a copy of an existing CharBuffer.
-
at(int)
- Return the integer at the specified index as a Char object.
-
begin()
- Return an iterator positioned at my first item.
-
charAt(int)
- Return the integer at the specified index as a Char object.
-
clone()
- Return a shallow copy of myself.
-
elements()
- Return an Enumeration of my components.
-
end()
- Return an iterator positioned immediately after my last item.
-
equals(char[])
- Return true if I contain the same items in the same order as
a native array of chars.
-
equals(CharArray)
- Return true if I contain the same items in the same order as
another CharArray.
-
equals(CharBuffer)
- Return true if I contain the same items in the same order as
another CharBuffer.
-
equals(Object)
- Return true if I'm equal to a specified object.
-
finish()
- Return an iterator positioned immediately after my last item.
-
get()
- Retrieve the underlying primitive array.
-
maxSize()
- Return the maximum number of objects that I can contain.
-
put(int, char)
- Set the value of a specified index.
-
put(int, Object)
- Set the object at a specified index.
-
size()
- Return the number of objects that I contain.
-
start()
- Return an iterator positioned at my first item.
-
toString()
- Return a string that describes me.
CharArray
public CharArray()
- Construct myself to refer to an empty array.
CharArray
public CharArray(CharArray array)
- Construct myself to refer to an existing CharArray.
- Parameters:
- array - The CharArray to copy.
CharArray
public CharArray(CharBuffer buffer)
- Construct myself to be a copy of an existing CharBuffer.
- Parameters:
- array - The CharBuffer to copy.
CharArray
public CharArray(char array[])
- Construct myself to refer to a native Java array.
- Parameters:
- array - The char[] to ape.
clone
public synchronized Object clone()
- Return a shallow copy of myself.
- Overrides:
- clone in class ArrayAdapter
toString
public synchronized String toString()
- Return a string that describes me.
- Overrides:
- toString in class Object
equals
public boolean equals(Object object)
- Return true if I'm equal to a specified object.
- Parameters:
- object - The object to compare myself against.
- Returns:
- true if I'm equal to the specified object.
- Overrides:
- equals in class ArrayAdapter
equals
public boolean equals(CharArray object)
- Return true if I contain the same items in the same order as
another CharArray.
- Parameters:
- array - The CharArray to compare myself against.
- Returns:
- true if I'm equal to the specified object.
equals
public boolean equals(CharBuffer buffer)
- Return true if I contain the same items in the same order as
another CharBuffer.
- Parameters:
- buffer - The CharBuffer to compare myself against.
equals
public synchronized boolean equals(char array[])
- Return true if I contain the same items in the same order as
a native array of chars.
- Parameters:
- array - The array to compare myself against.
get
public char[] get()
- Retrieve the underlying primitive array.
size
public int size()
- Return the number of objects that I contain.
maxSize
public int maxSize()
- Return the maximum number of objects that I can contain.
- Overrides:
- maxSize in class ArrayAdapter
elements
public Enumeration elements()
- Return an Enumeration of my components.
start
public ForwardIterator start()
- Return an iterator positioned at my first item.
begin
public synchronized CharIterator begin()
- Return an iterator positioned at my first item.
finish
public ForwardIterator finish()
- Return an iterator positioned immediately after my last item.
end
public synchronized CharIterator end()
- Return an iterator positioned immediately after my last item.
at
public Object at(int index)
- Return the integer at the specified index as a Char object.
- Parameters:
- index - The index.
charAt
public synchronized char charAt(int index)
- Return the integer at the specified index as a Char object.
- Parameters:
- index - The index.
put
public void put(int index,
Object object)
- Set the object at a specified index. The object must be a Character
- Parameters:
- index - The index.
- object - The object to place at the specified index.
- Throws: ClassCastException
- if object is not a Character
- Throws: IndexOutOfBoundsException
- if index is invalid.
put
public synchronized void put(int index,
char object)
- Set the value of a specified index.
- Parameters:
- index - The index.
- object - The char to place at the specified index.
- Throws: IndexOutOfBoundsException
- if index is invalid.
All Packages Class Hierarchy This Package Previous Next Index