|
||||||||||
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(java.lang.Class klass)
Constructs an array of the specified class. |
Method Summary | |
---|---|
void |
add(java.lang.Object val)
Adds an object. |
java.lang.Object |
clone()
|
boolean |
equals(java.lang.Object o)
|
int |
hashCode()
|
boolean |
isEmpty()
Returns if it is empty. |
boolean |
remove(java.lang.Object val)
Removes an object. |
boolean |
removeBy(java.lang.Comparable val,
boolean atMostOne)
Removes the object(s) that matches the specified condition. |
int |
size()
Returns the size. |
java.lang.Object[] |
toArray()
Returns the array (never null). |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FastReadArray()
public FastReadArray(java.lang.Class klass)
Method Detail |
---|
public java.lang.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(java.lang.Object val)
public boolean remove(java.lang.Object val)
public boolean removeBy(java.lang.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 java.lang.Object clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |