Package com.google.gwt.core.client
Class JsArrayString
java.lang.Object
com.google.gwt.core.client.JavaScriptObject
com.google.gwt.core.client.JsArrayString
A simple wrapper around a homogeneous native array of string values.
This class may not be directly instantiated, and can only be returned from a
native method. For example,
native JsArrayString getNativeArray() /*-{
return ['foo', 'bar', 'baz'];
}-* /;
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal String
get
(int index) Gets the value at a given index.final String
join()
Convert each element of the array to a String and join them with a comma separator.final String
Convert each element of the array to a String and join them with a comma separator.final int
length()
Gets the length of the array.final void
Pushes the given value onto the end of the array.final void
Sets the value value at a given index.final void
setLength
(int newLength) Reset the length of the array.final String
shift()
Shifts the first value off the array.final void
Shifts a value onto the beginning of the array.Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
-
Constructor Details
-
JsArrayString
protected JsArrayString()
-
-
Method Details
-
get
Gets the value at a given index.- Parameters:
index
- the index to be retrieved- Returns:
- the value at the given index, or
null
if none exists
-
join
Convert each element of the array to a String and join them with a comma separator. The value returned from this method may vary between browsers based on how JavaScript values are converted into strings. -
join
Convert each element of the array to a String and join them with a comma separator. The value returned from this method may vary between browsers based on how JavaScript values are converted into strings. -
length
public final int length()Gets the length of the array.- Returns:
- the array length
-
push
Pushes the given value onto the end of the array. -
set
Sets the value value at a given index. If the index is out of bounds, the value will still be set. The array's length will be updated to encompass the bounds implied by the added value.- Parameters:
index
- the index to be setvalue
- the value to be stored
-
setLength
public final void setLength(int newLength) Reset the length of the array.- Parameters:
newLength
- the new length of the array
-
shift
Shifts the first value off the array.- Returns:
- the shifted value
-
unshift
Shifts a value onto the beginning of the array.- Parameters:
value
- the value to the stored
-