|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.util.FastReadArray
public class FastReadArray
An array of objects that are fast to read but a bit slower to add and remove.
It is thread-safe.
Typical use:
Object[] ary = fra.toArray();
for (int j = 0; j < ary.length; ++j)
whatever;
| Constructor Summary | |
|---|---|
FastReadArray()
Constructs an array of Object. |
|
FastReadArray(Class klass)
Constructs an array of the specified class. |
|
| Method Summary | |
|---|---|
void |
add(Object val)
Adds an object. |
Object |
clone()
|
boolean |
equals(Object o)
|
int |
hashCode()
|
boolean |
isEmpty()
Returns if it is empty. |
boolean |
remove(Object val)
Removes an object. |
boolean |
removeBy(Comparable val,
boolean atMostOne)
Removes the object(s) that matches the specified condition. |
int |
size()
Returns the size. |
Object[] |
toArray()
Returns the array (never null). |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FastReadArray()
public FastReadArray(Class klass)
| Method Detail |
|---|
public Object[] toArray()
Note: the return array is readonly. Don't modify the value of any element.
public boolean isEmpty()
public int size()
public void add(Object val)
public boolean remove(Object val)
public boolean removeBy(Comparable val,
boolean atMostOne)
Comparable.compareTo(java.lang.Object) returns 0.
In other words, this method invokes val.compareTo() against
each element in this array.
atMostOne - whether to remove the first matched object only.
If true, only the first matched object, if any, is removed.
If false, all matched object are removed.public Object clone()
clone in class Objectpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||