- All Known Implementing Classes:
DOMTokenListImpl
,DOMTokenSetImpl
Based on DOM interface DOMTokenList
which is actually a set.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given token to this collection.boolean
Does this collection contains this token?boolean
containsAll
(DOMTokenList otherlist) Does this collection contain all the tokens in the suppliedDOMTokenList
?boolean
containsAll
(Collection<String> tokenSet) Does this collection contain all the tokens in the given collection?int
Gets 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.void
Removes the given token from this collection.void
Replaces an existing token with a new token.boolean
If 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
null
if 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:
true
if the list contains the given token,false
otherwise.
-
containsAll
Does this collection contain all the tokens in the suppliedDOMTokenList
?- Parameters:
otherlist
- anotherDOMTokenList
.- Returns:
true
if this list contains all the tokens in the givenotherlist
,false
otherwise.- Throws:
DOMException
- SYNTAX_ERR if the argument isnull
or empty.
-
containsAll
Does this collection contain all the tokens in the given collection?- Parameters:
tokenSet
- the collection of tokens.- Returns:
true
if the list contains all the tokens in the given set, false otherwise.- Throws:
DOMException
- SYNTAX_ERR if the argument isnull
or 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 isnull
or 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 isnull
or 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:
true
if the token is added,false
if it is removed.- Throws:
DOMException
- SYNTAX_ERR if the token isnull
or 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 isnull
or empty. INVALID_CHARACTER_ERR if any of the tokens contains spaces.
-