DOMStringList
Stay organized with collections
Save and categorize content based on your preferences.
The DOMStringList
interface provides the abstraction of an
ordered collection of DOMString
values, without defining or
constraining how this collection is implemented. The items in the
DOMStringList
are accessible via an integral index, starting
from 0.
See also the Document Object Model (DOM) Level 3 Core Specification.
Public Method Summary
abstract
boolean
|
|
abstract
int
|
getLength()
The number of DOMString s in the list.
|
abstract
String
|
item(int index)
Returns the index th item in the collection.
|
Public Methods
public
abstract
boolean
contains
(String str)
Test if a string is part of this DOMStringList
.
Parameters
str |
The string to look for. |
Returns
true
if the string has been found,
false
otherwise.
public
abstract
int
getLength
()
The number of DOMString
s in the list. The range of valid
child node indices is 0 to length-1
inclusive.
public
abstract
String
item
(int index)
Returns the index
th item in the collection. If
index
is greater than or equal to the number of
DOMString
s in the list, this returns null
.
Parameters
index |
Index into the collection. |
Returns
- The
DOMString
at the index
th
position in the DOMStringList
, or null
if
that is not a valid index.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eDOMStringList\u003c/code\u003e is an interface representing an ordered collection of \u003ccode\u003eDOMString\u003c/code\u003e values, accessible by index starting from 0.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to check if a string is in the list (\u003ccode\u003econtains\u003c/code\u003e), get the list's size (\u003ccode\u003egetLength\u003c/code\u003e), and retrieve an item by its index (\u003ccode\u003eitem\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eIf an index provided to the \u003ccode\u003eitem\u003c/code\u003e method is out of bounds, it will return \u003ccode\u003enull\u003c/code\u003e.\u003c/p\u003e\n"]]],["`DOMStringList` represents an ordered collection of `DOMString` values, accessible via an index starting from 0. Key actions include: `contains(String str)` to check if a string exists in the list, `getLength()` to retrieve the total number of strings, and `item(int index)` to get the string at a specified index. If the index is out of bounds, `item` returns `null`. The range of valid indexes are from 0 to length -1.\n"],null,["# DOMStringList\n\npublic interface **DOMStringList** \nThe `DOMStringList` interface provides the abstraction of an\nordered collection of `DOMString` values, without defining or\nconstraining how this collection is implemented. The items in the\n`DOMStringList` are accessible via an integral index, starting\nfrom 0.\n\nSee also the [Document Object Model (DOM) Level 3 Core Specification](http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407). \n\n### Public Method Summary\n\n|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract boolean | [contains](../../../../reference/org/w3c/dom/DOMStringList.html#contains(java.lang.String))([String](../../../../reference/java/lang/String.html) str) Test if a string is part of this `DOMStringList`. |\n| abstract int | [getLength](../../../../reference/org/w3c/dom/DOMStringList.html#getLength())() The number of `DOMString`s in the list. |\n| abstract [String](../../../../reference/java/lang/String.html) | [item](../../../../reference/org/w3c/dom/DOMStringList.html#item(int))(int index) Returns the `index`th item in the collection. |\n\nPublic Methods\n--------------\n\n#### public abstract boolean\n**contains**\n([String](../../../../reference/java/lang/String.html) str)\n\nTest if a string is part of this `DOMStringList`. \n\n##### Parameters\n\n| str | The string to look for. |\n|-----|-------------------------|\n\n##### Returns\n\n- `true` if the string has been found, `false` otherwise. \n\n#### public abstract int\n**getLength**\n()\n\nThe number of `DOMString`s in the list. The range of valid\nchild node indices is 0 to `length-1` inclusive. \n\n#### public abstract [String](../../../../reference/java/lang/String.html)\n**item**\n(int index)\n\nReturns the `index`th item in the collection. If\n`index` is greater than or equal to the number of\n`DOMString`s in the list, this returns `null`. \n\n##### Parameters\n\n| index | Index into the collection. |\n|-------|----------------------------|\n\n##### Returns\n\n- The `DOMString` at the `index`th position in the `DOMStringList`, or `null` if that is not a valid index."]]