T - type of stored values.public class VKList<T extends VKApiModel & android.os.Parcelable & Identifiable> extends VKApiModel implements java.util.List<T>, android.os.Parcelable
| Modifier and Type | Class and Description |
|---|---|
static interface |
VKList.Parser<D>
Used when parsing the list objects as interator created from
JSONArray a instances of items of the list. |
static class |
VKList.ReflectParser<D extends VKApiModel>
Parser list items using reflection mechanism.
|
| Modifier and Type | Field and Description |
|---|---|
static android.os.Parcelable.Creator<VKList> |
CREATOR |
fields| Constructor and Description |
|---|
VKList()
Creates empty list.
|
VKList(org.json.JSONArray from,
java.lang.Class<? extends T> clazz)
Creates list and fills it according with data in
from. |
VKList(org.json.JSONArray from,
VKList.Parser<T> creator)
Creates list and fills it according with data in
from. |
VKList(org.json.JSONObject from,
java.lang.Class<? extends T> clazz)
Creates list and fills it according with data in
from. |
VKList(org.json.JSONObject from,
VKList.Parser<T> creator)
Creates list and fills it according with data in
from. |
VKList(java.util.List<? extends T> data)
Creates list and fills it according with given data.
|
VKList(android.os.Parcel in)
Creates list from Parcel
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int location,
T object) |
boolean |
add(T object) |
void |
addAfter(int id,
T data)
Adds the element after the element with the specified id.
|
boolean |
addAll(java.util.Collection<? extends T> collection) |
boolean |
addAll(int location,
java.util.Collection<? extends T> collection) |
void |
addBefore(int id,
T data)
Adds the element before the element with the specified id.
|
void |
clear() |
boolean |
contains(java.lang.Object object) |
boolean |
containsAll(java.util.Collection<?> collection) |
int |
describeContents() |
boolean |
equals(java.lang.Object object) |
void |
fill(org.json.JSONArray from,
java.lang.Class<? extends T> clazz)
Creates list and fills it according with data in
from. |
void |
fill(org.json.JSONArray from,
VKList.Parser<? extends T> creator)
Fills list according with data in
from. |
void |
fill(org.json.JSONObject from,
java.lang.Class<? extends T> clazz)
Fills list according with data in
from. |
void |
fill(org.json.JSONObject from,
VKList.Parser<? extends T> creator)
Fills list according with data in
from. |
T |
get(int location) |
T |
getById(int id)
Returns element according with id.
|
int |
getCount()
Returns the return value of the field VK API
count, if it has been returned, and the size of the list, if not. |
int |
indexOf(java.lang.Object object) |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
int |
lastIndexOf(java.lang.Object object) |
java.util.ListIterator<T> |
listIterator() |
java.util.ListIterator<T> |
listIterator(int location) |
VKApiModel |
parse(org.json.JSONObject response)
Parses object from source.
|
T |
remove(int location) |
boolean |
remove(java.lang.Object object) |
boolean |
removeAll(java.util.Collection<?> collection) |
boolean |
retainAll(java.util.Collection<?> collection) |
VKList<T> |
search(java.lang.String query)
Searches through the list of available items.
|
T |
set(int location,
T object) |
int |
size() |
java.util.List<T> |
subList(int start,
int end) |
java.lang.Object[] |
toArray() |
<T1> T1[] |
toArray(T1[] array) |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
getTag, getTag, setTag, setTagpublic static android.os.Parcelable.Creator<VKList> CREATOR
public VKList()
public VKList(java.util.List<? extends T> data)
public VKList(org.json.JSONObject from,
java.lang.Class<? extends T> clazz)
from.from - an object that represents a list adopted in accordance with VK API format. You can use null.clazz - class represents a model that has a public constructor with JSONObject argument.public VKList(org.json.JSONArray from,
java.lang.Class<? extends T> clazz)
from.from - an array of items in the list. You can use null.clazz - class represents a model that has a public constructor with JSONObject argument.public VKList(org.json.JSONObject from,
VKList.Parser<T> creator)
from.from - an object that represents a list adopted in accordance with VK API format. You can use null.creator - interface implementation to parse objects.public VKList(org.json.JSONArray from,
VKList.Parser<T> creator)
from.from - an array of items in the list. You can use null.creator - interface implementation to parse objects.public VKList(android.os.Parcel in)
public void fill(org.json.JSONObject from,
java.lang.Class<? extends T> clazz)
from.from - an object that represents a list adopted in accordance with VK API format. You can use null.clazz - class represents a model that has a public constructor with JSONObject argument.public void fill(org.json.JSONArray from,
java.lang.Class<? extends T> clazz)
from.from - an array of items in the list. You can use null.clazz - class represents a model that has a public constructor with JSONObject argument.public void fill(org.json.JSONObject from,
VKList.Parser<? extends T> creator)
from.from - an object that represents a list adopted in accordance with VK API format. You can use null.creator - interface implementation to parse objects.public void fill(org.json.JSONArray from,
VKList.Parser<? extends T> creator)
from.from - an array of items in the list. You can use null.creator - interface implementation to parse objects.public void addBefore(int id,
T data)
id - element identifier to add element before it.data - element to addpublic void addAfter(int id,
T data)
id - element identifier to add element after it.data - element to addpublic T getById(int id)
public VKList<T> search(java.lang.String query)
T must have overridden method Object.toString(),
search will be carried out exactly according to the result of calling this method.
- Hello world
- Hello test
In this case, the matches will be on search phrases 'Hel', 'Hello', 'test', but not on 'llo', 'llo world'query - search query can not be equal to null, but can be an empty string.public int getCount()
count, if it has been returned, and the size of the list, if not.public void add(int location,
T object)
add in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public boolean add(T object)
add in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>add in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public boolean addAll(int location,
@NonNull
java.util.Collection<? extends T> collection)
addAll in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public boolean addAll(@NonNull
java.util.Collection<? extends T> collection)
addAll in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>addAll in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public void clear()
clear in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>clear in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public boolean contains(java.lang.Object object)
contains in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>contains in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public boolean containsAll(@NonNull
java.util.Collection<?> collection)
containsAll in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>containsAll in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public boolean equals(java.lang.Object object)
equals in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>equals in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>equals in class java.lang.Objectpublic T get(int location)
get in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public int indexOf(java.lang.Object object)
indexOf in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public boolean isEmpty()
isEmpty in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>isEmpty in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>@NonNull public java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T extends VKApiModel & android.os.Parcelable & Identifiable>iterator in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>iterator in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public int lastIndexOf(java.lang.Object object)
lastIndexOf in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public java.util.ListIterator<T> listIterator()
listIterator in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>@NonNull public java.util.ListIterator<T> listIterator(int location)
listIterator in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public T remove(int location)
remove in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public boolean remove(java.lang.Object object)
remove in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>remove in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public boolean removeAll(@NonNull
java.util.Collection<?> collection)
removeAll in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>removeAll in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public boolean retainAll(@NonNull
java.util.Collection<?> collection)
retainAll in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>retainAll in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public T set(int location, T object)
set in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public int size()
size in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>size in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>@NonNull public java.util.List<T> subList(int start, int end)
subList in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>@NonNull public java.lang.Object[] toArray()
toArray in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>toArray in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>@NonNull
public <T1> T1[] toArray(@NonNull
T1[] array)
toArray in interface java.util.Collection<T extends VKApiModel & android.os.Parcelable & Identifiable>toArray in interface java.util.List<T extends VKApiModel & android.os.Parcelable & Identifiable>public int describeContents()
describeContents in interface android.os.Parcelablepublic void writeToParcel(android.os.Parcel dest,
int flags)
writeToParcel in interface android.os.Parcelablepublic VKApiModel parse(org.json.JSONObject response) throws org.json.JSONException
VKApiModelparse in class VKApiModelresponse - server API object.org.json.JSONException - if any critical error occurred while parsing.