- All Known Implementing Classes:
DOMTokenListImpl,DOMTokenSetImpl
Based on DOM interface DOMTokenList
which is actually a set.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given token to this collection.booleanDoes this collection contains this token?booleancontainsAll(DOMTokenList otherlist) Does this collection contain all the tokens in the suppliedDOMTokenList?booleancontainsAll(Collection<String> tokenSet) Does this collection contain all the tokens in the given collection?intGets the number of tokens stored in this collection.Gets the value of the collection as a String, with the tokens alphabetically ordered.getValue()Gets the value of the collection as a String.item(int index) Retrieves a token from the collection by its index.iterator()Obtain an iterator over the members of this set.voidRemoves the given token from this collection.voidReplaces an existing token with a new token.booleanIf the given token exists in this collection, remove it; otherwise add it.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getLength
int getLength()Gets the number of tokens stored in this collection.- Returns:
- the number of tokens stored in this collection.
-
getValue
String getValue()Gets the value of the collection as a String.- Returns:
- the value of the collection as a String.
-
getSortedValue
String getSortedValue()Gets the value of the collection as a String, with the tokens alphabetically ordered.- Returns:
- the value of the collection as an alphabetically ordered string.
-
item
Retrieves a token from the collection by its index.- Parameters:
index- the index.- Returns:
- the token in the given place of this collection, or
nullif the index is negative, greater than or equal to the length of this collection.
-
iterator
Obtain an iterator over the members of this set. -
contains
Does this collection contains this token?- Parameters:
token- the token.- Returns:
trueif the list contains the given token,falseotherwise.
-
containsAll
Does this collection contain all the tokens in the suppliedDOMTokenList?- Parameters:
otherlist- anotherDOMTokenList.- Returns:
trueif this list contains all the tokens in the givenotherlist,falseotherwise.- Throws:
DOMException- SYNTAX_ERR if the argument isnullor empty.
-
containsAll
Does this collection contain all the tokens in the given collection?- Parameters:
tokenSet- the collection of tokens.- Returns:
trueif the list contains all the tokens in the given set, false otherwise.- Throws:
DOMException- SYNTAX_ERR if the argument isnullor empty.
-
add
Adds the given token to this collection.If the set already contains the token, then do nothing.
- Parameters:
token- the token to add.- Throws:
DOMException- SYNTAX_ERR if the token isnullor empty. INVALID_CHARACTER_ERR if the token contains spaces.
-
remove
Removes the given token from this collection.- Parameters:
token- the token to remove.- Throws:
DOMException- SYNTAX_ERR if the token isnullor empty. INVALID_CHARACTER_ERR if the token contains spaces.
-
toggle
If the given token exists in this collection, remove it; otherwise add it.- Parameters:
token- the token to toggle.- Returns:
trueif the token is added,falseif it is removed.- Throws:
DOMException- SYNTAX_ERR if the token isnullor empty. INVALID_CHARACTER_ERR if the token contains spaces.
-
replace
Replaces an existing token with a new token.If the set does not contain the token, do nothing.
- Parameters:
oldToken- the token that has to be replaced.newToken- the new token.- Throws:
DOMException- SYNTAX_ERR if any of the tokens isnullor empty. INVALID_CHARACTER_ERR if any of the tokens contains spaces.
-