class CharArraySet {
/** Add this char[] directly to the set.
* If ignoreCase is true for this Set, the text array will be directly modified.
* The user should never modify this text array after calling this method.
*/
public boolean add(char[] text) {
if (ignoreCase)
for(int i=0;i<text.length;i++)
text[i] = Character.toLowerCase(text[i]);
int slot = getSlot(text, 0, text.length);
if (entries[slot] != null) return false;
entries[slot] = text;
count++;
if (count + (count>>2) > entries.length) {
rehash();
}
return true;
}
}
class CharArraySet.UnmodifiableCharArraySet {
public boolean add(char[] text) {
throw new UnsupportedOperationException();
}
}
|