public class CharVector extends Object implements Cloneable, Serializable
This class implements a simple char vector with access to the underlying array.
This work was authored by Carlos Villegas (cav@uniscope.co.jp).
| Constructor and Description |
|---|
CharVector()
Construct char vector instance with default block size.
|
CharVector(char[] a)
Construct char vector instance.
|
CharVector(char[] a,
int capacity)
Construct char vector instance.
|
CharVector(int capacity)
Construct char vector instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
alloc(int size)
This is to implement memory allocation in the array.
|
int |
capacity()
Obtain capacity of array.
|
void |
clear()
Reset length of vector, but don't clear contents.
|
Object |
clone() |
char |
get(int index)
Get char at index.
|
char[] |
getArray()
Obtain char vector array.
|
int |
length()
Obtain number of items in array.
|
void |
put(int index,
char val)
Pet char at index.
|
void |
trimToSize()
Trim char vector to current length.
|
public CharVector()
public CharVector(int capacity)
capacity - initial block sizepublic CharVector(char[] a)
a - char array to usepublic CharVector(char[] a,
int capacity)
a - char array to usecapacity - initial block sizepublic void clear()
public Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic char[] getArray()
public int length()
public int capacity()
public void put(int index,
char val)
index - the indexval - a charpublic char get(int index)
index - the indexpublic int alloc(int size)
size - to allocatepublic void trimToSize()
Copyright © 2023 Apache Software Foundation. All rights reserved.