public class DataValueList extends ListBase implements java.lang.Iterable<DataValue>
A list of item type DataValue
.
Uses the property and function naming conventions of the JavaScript Array object.
Modifier and Type | Field and Description |
---|---|
static DataValueList |
empty |
Constructor and Description |
---|
DataValueList()
See DataValueList(int).
|
DataValueList(int capacity)
Construct a new list with
DataValueList.length of zero and optional initial capacity . |
Modifier and Type | Method and Description |
---|---|
void |
add(DataValue item)
Add
item to the end of this list. |
void |
addAll(DataValueList list)
Add all the items of
list to the end of this list. |
DataValueList |
addNullable(DataValue item)
Append
item to the end of this list. |
DataValueList |
addThis(DataValue item)
Add
item to the end of this list. |
static DataValueList |
castRequired(DataValue value)
For internal use only.
|
DataValueList |
copy()
Return a shallow copy of this list.
|
static boolean |
equal(DataValueList a,
DataValueList b)
Return
true if two value lists have equal items. |
DataValue |
first()
Return the first item in this list.
|
static DataValueList |
from(java.util.List<DataValue> list) |
static DataValueList |
fromNullable(java.util.List<DataValue> list) |
DataValue |
get(int index)
Return the item in this list at the specified
index . |
DataType |
getDataType()
Return the data type for this list.
|
java.lang.String |
getNextLink()
Return (nullable) An optional link that can be followed (by the caller, not by this DataValueList) to fetch additional list items.
|
DataValue |
getNullable(int index)
Return (nullable) The item in this list at the specified
index , which might be null . |
java.lang.String |
getReadLink()
Return (nullable) An optional link that can be followed (by the caller, not by this DataValueList) to re-read this list.
|
java.lang.Long |
getTotalCount()
Return (nullable) Total number of items available in the server-side list, which may be greater than
DataValueList.length if the client requested an inline DataQuery.count . |
boolean |
includes(DataValue item)
Return
true if this list contains item . |
int |
indexOf(DataValue item)
|
int |
indexOf(DataValue item,
int start)
Return first index in this list of
item , or -1 if not found. |
void |
insertAll(int index,
DataValueList list)
Insert all items of
list into this list, before the item (if any) at index . |
void |
insertAt(int index,
DataValue item)
Insert
item into this list, before the item (if any) at index . |
boolean |
isReference()
Return
true if this list is a referece. |
java.util.Iterator<DataValue> |
iterator() |
DataValue |
last()
Return the last item in this list.
|
int |
lastIndexOf(DataValue item)
|
int |
lastIndexOf(DataValue item,
int start)
Return last index in this list of
item , or -1 if not found. |
void |
set(int index,
DataValue item)
Set the item in this list at the specified
index . |
void |
setNextLink(java.lang.String value)
Set an optional link that can be followed (by the caller, not by this DataValueList) to fetch additional list items.
|
void |
setNullable(int index,
DataValue item)
Set the item in this list at the specified
index . |
void |
setReadLink(java.lang.String value)
Set an optional link that can be followed (by the caller, not by this DataValueList) to re-read this list.
|
void |
setReference(boolean value)
Set
true if this list is a referece. |
void |
setTotalCount(java.lang.Long value)
Set total number of items available in the server-side list, which may be greater than
DataValueList.length if the client requested an inline DataQuery.count . |
static DataValueList |
share(ListBase list)
|
static DataValueList |
shareNullable(ListBase list)
Return a new DataValueList that shares the
ListBase.untypedList as the list parameter, including nulls. |
DataValue |
single()
Return a single item from this list.
|
DataValueList |
slice(int start)
See slice(int, int).
|
DataValueList |
slice(int start,
int end)
Return a slice of this list from index
start (inclusive) to index end (exclusive). |
java.util.List<DataValue> |
toGeneric() |
DataValueList |
withItemType(DataType type)
Override the type of this list, and return this list.
|
DataValueListWithNulls |
withNulls()
Return an iterator of this list which uses a nullable item type.
|
DataValueList |
withType(DataType type)
Override the type of this list, and return this list.
|
clear, getComparer, getEquality, getUntypedList, isEmpty, length, removeAt, removeFirst, removeLast, removeRange, reverse, shareWith, sort, sortWith, toDynamic, toString, validate
cloneMutable, equals, getTypeCode, hashCode
public static final DataValueList empty
public DataValueList()
public DataValueList(int capacity)
Construct a new list with DataValueList.length
of zero and optional initial capacity
.
A list can expand in length beyond its initial capacity, but best performance
will be obtained if the initial capacity is close to the list's maximum length.
capacity
- Optional initial capacity.public void add(DataValue item)
Add item
to the end of this list.
item
- Item to be added.public void addAll(DataValueList list)
Add all the items of list
to the end of this list.
list
- Items to be added.public DataValueList addNullable(DataValue item)
Append item
to the end of this list.
It is unusual for a DataValueList
to contain null
items, so DataValueList.add
is usually used.
item
- (nullable) Item to be added, which might be null
.public DataValueList addThis(DataValue item)
Add item
to the end of this list.
item
- Item to be added.public static DataValueList castRequired(DataValue value)
For internal use only.
value
- (internal use only)public DataValueList copy()
Return a shallow copy of this list.
public static boolean equal(DataValueList a, DataValueList b)
Return true
if two value lists have equal items.
a
- (nullable) First value list.b
- (nullable) Second value list.public DataValue first()
Return the first item in this list.
EmptyListException
if the list is empty.
public static DataValueList from(java.util.List<DataValue> list)
public static DataValueList fromNullable(java.util.List<DataValue> list)
public DataValue get(int index)
Return the item in this list at the specified index
.
ListIndexException
if index
is out of range (0 to DataValueList.length
- 1).
index
- Zero-based index.public DataType getDataType()
Return the data type for this list.
getDataType
in class ListBase
public java.lang.String getNextLink()
Return (nullable) An optional link that can be followed (by the caller, not by this DataValueList) to fetch additional list items. If this value list was produced via server-driven paging, then the server may have provided a next-link which can be followed to obtain more items.
public DataValue getNullable(int index)
Return (nullable) The item in this list at the specified index
, which might be null
.
It is unusual for a DataValueList
to contain null
items, so DataValueList.get
is usually used (although DataValueList.get
will throw an exception for a null
item).
ListIndexException
if index
is out of range (0 to DataValueList.length
- 1).
index
- Zero-based index.public java.lang.String getReadLink()
Return (nullable) An optional link that can be followed (by the caller, not by this DataValueList) to re-read this list.
public java.lang.Long getTotalCount()
Return (nullable) Total number of items available in the server-side list, which may be greater than DataValueList.length
if the client requested an inline DataQuery.count
.
DataValueList.length
if the client requested an inline DataQuery.count
.public boolean includes(DataValue item)
Return true
if this list contains item
.
item
- Item for comparison. Comparison uses the DataValueList.equality
property, which would usually be expected to match the ==
operator for item type DataValue
.true
if this list contains item
.public int indexOf(DataValue item)
item
- Item parameter.public int indexOf(DataValue item, int start)
Return first index in this list of item
, or -1
if not found.
item
- Item for comparison. Comparison uses the DataValueList.equality
property, which would usually be expected to match the ==
operator for item type DataValue
.start
- Zero-based starting index (search moves forwards from this index).item
, or -1
if not found.public void insertAll(int index, DataValueList list)
Insert all items of list
into this list, before the item (if any) at index
.
ListIndexException
if index
is out of range (0 to DataValueList.length
).
index
- Zero-based index.list
- List of items to be inserted.public void insertAt(int index, DataValue item)
Insert item
into this list, before the item (if any) at index
.
ListIndexException
if index
is out of range (0 to DataValueList.length
).
index
- Zero-based index.item
- Item to be added.public boolean isReference()
Return true
if this list is a referece. If true
, the DataValueList.readLink
will be non-null, and this list will be empty.
true
if this list is a referece. If true
, the DataValueList.readLink
will be non-null, and this list will be empty.public java.util.Iterator<DataValue> iterator()
iterator
in interface java.lang.Iterable<DataValue>
public DataValue last()
Return the last item in this list.
EmptyListException
if the list is empty.
public int lastIndexOf(DataValue item)
item
- Item parameter.public int lastIndexOf(DataValue item, int start)
Return last index in this list of item
, or -1
if not found.
item
- Item for comparison. Comparison uses the DataValueList.equality
property, which would usually be expected to match the ==
operator for item type DataValue
.start
- Zero-based starting index (search moves backwards from this index).item
, or -1
if not found.public void set(int index, DataValue item)
Set the item in this list at the specified index
.
index
- Zero-based index.item
- Item value.public void setNextLink(java.lang.String value)
Set an optional link that can be followed (by the caller, not by this DataValueList) to fetch additional list items. If this value list was produced via server-driven paging, then the server may have provided a next-link which can be followed to obtain more items.
value
- An optional link that can be followed (by the caller, not by this DataValueList) to fetch additional list items.public void setNullable(int index, DataValue item)
Set the item in this list at the specified index
.
It is unusual for a DataValueList
to contain null
items, so DataValueList.set
is usually used.
index
- Zero-based index.item
- (nullable) Item value, which might be null
.public void setReadLink(java.lang.String value)
Set an optional link that can be followed (by the caller, not by this DataValueList) to re-read this list.
value
- An optional link that can be followed (by the caller, not by this DataValueList) to re-read this list.public void setReference(boolean value)
Set true
if this list is a referece. If true
, the DataValueList.readLink
will be non-null, and this list will be empty.
value
- true
if this list is a referece. If true
, the DataValueList.readLink
will be non-null, and this list will be empty.public void setTotalCount(java.lang.Long value)
Set total number of items available in the server-side list, which may be greater than DataValueList.length
if the client requested an inline DataQuery.count
.
value
- Total number of items available in the server-side list, which may be greater than DataValueList.length
if the client requested an inline DataQuery.count
.public static DataValueList share(ListBase list)
Return a new DataValueList
that shares the ListBase.untypedList
as the list
parameter.
To ensure type safety, items in list
that do not have the item type DataValue
will be removed.
list
- List whose items will be shared by the resulting list.DataValue
, sharing the same items as list
.public static DataValueList shareNullable(ListBase list)
Return a new DataValueList that shares the ListBase.untypedList
as the list
parameter, including nulls.
To ensure type safety, items in list
that do not have the item type will be removed.
list
- List whose items will be shared by the resulting list.DataValue
, sharing the same items as list
.public DataValue single()
Return a single item from this list.
EmptyListException
if the list has no items, NotUniqueException
if the list has multiple items.
public DataValueList slice(int start)
start
- Start parameter.public DataValueList slice(int start, int end)
Return a slice of this list from index start
(inclusive) to index end
(exclusive).
start
- Zero-based starting index (inclusive), or negative for starting index relative to the end of this list.end
- Zero-based ending index (exclusive), or negative for ending index relative to the end of this list.start
(inclusive) to index end
(exclusive).public java.util.List<DataValue> toGeneric()
public DataValueList withItemType(DataType type)
Override the type of this list, and return this list.
type
- Data type for the items in this list.public DataValueListWithNulls withNulls()
Return an iterator of this list which uses a nullable item type.
public DataValueList withType(DataType type)
Override the type of this list, and return this list.
type
- Data type for a list of data values. Use DataType.listOf
to obtain a suitable list type.