E - The class of objects in this listpublic class RealmResults<E extends RealmObject>
extends java.util.AbstractList<E>
RealmQuery.findAll(),
Realm.allObjects(Class)| Modifier and Type | Field and Description |
|---|---|
static boolean |
SORT_ORDER_ASCENDING |
static boolean |
SORT_ORDER_DECENDING |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E element)
Deprecated.
|
void |
add(int index,
E element)
Deprecated.
|
double |
average(java.lang.String fieldName)
Returns the average of a given field.
|
void |
clear()
Removes all objects from the list.
|
E |
first()
Get the first object from the list.
|
E |
get(int rowIndex) |
E |
last()
Get the last object from the list.
|
java.lang.Number |
max(java.lang.String fieldName)
Find the maximum value of a field.
|
java.util.Date |
maxDate(java.lang.String fieldName)
Find the maximum date.
|
java.lang.Number |
min(java.lang.String fieldName)
Find the minimum value of a field.
|
java.util.Date |
minDate(java.lang.String fieldName)
Find the minimum date.
|
E |
remove(int index)
Removes an object at a given index.
|
void |
removeLast()
Removes the last object in the list.
|
int |
size() |
RealmResults<E> |
sort(java.lang.String fieldName)
Get a sorted (ascending) RealmList from an existing @{link io.realm.RealmList}.
|
RealmResults<E> |
sort(java.lang.String fieldName,
boolean sortAscending)
Get a sorted RealmList from an existing @{link io.realm.RealmList}.
|
java.lang.Number |
sum(java.lang.String fieldName)
Calculate the sum of a given field.
|
RealmQuery<E> |
where()
Returns a typed @{link io.realm.RealmQuery}, which can be used to query for specific
objects of this type.
|
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringpublic static final boolean SORT_ORDER_ASCENDING
public static final boolean SORT_ORDER_DECENDING
public RealmQuery<E> where()
RealmQuerypublic E get(int rowIndex)
get in interface java.util.List<E extends RealmObject>get in class java.util.AbstractList<E extends RealmObject>public E first()
public E last()
public RealmResults<E> sort(java.lang.String fieldName)
fieldName - The field name to sort by.public RealmResults<E> sort(java.lang.String fieldName, boolean sortAscending)
fieldName - The field name to sort by.sortAscending - The direction to sort by; if true ascending, otherwise descending
You can use the constants SORT_ORDER_ASCENDING and SORT_ORDER_DECENDING
for readability.public int size()
size in interface java.util.Collection<E extends RealmObject>size in interface java.util.List<E extends RealmObject>size in class java.util.AbstractCollection<E extends RealmObject>public java.lang.Number min(java.lang.String fieldName)
fieldName - The field to look for a minimum on. Only int, float, and double
are supported.java.lang.IllegalArgumentException - if field is not int, float or double.public java.util.Date minDate(java.lang.String fieldName)
fieldName - The field to look for the minimum date. If fieldName is not of Date type,
an exception is thrown.java.lang.IllegalArgumentException - if fieldName is not a Date field.public java.lang.Number max(java.lang.String fieldName)
fieldName - The field to look for a maximum on. Only int, float, and double are supported.java.lang.IllegalArgumentException - if field is not int, float or double.public java.util.Date maxDate(java.lang.String fieldName)
fieldName - The field to look for the maximum date. If fieldName is not of Date type,
an exception is thrown.java.lang.IllegalArgumentException - if fieldName is not a Date field.public java.lang.Number sum(java.lang.String fieldName)
fieldName - The field to sum. Only int, float, and double are supported.java.lang.IllegalArgumentException - if field is not int, float or double.public double average(java.lang.String fieldName)
fieldName - The field to calculate average on. Only properties of type int,
float and double are supported.java.lang.IllegalArgumentException - if field is not int, float or double.public E remove(int index)
remove in interface java.util.List<E extends RealmObject>remove in class java.util.AbstractList<E extends RealmObject>index - The array index identifying the object to be removed.public void removeLast()
public void clear()
clear in interface java.util.Collection<E extends RealmObject>clear in interface java.util.List<E extends RealmObject>clear in class java.util.AbstractList<E extends RealmObject>@Deprecated public boolean add(E element)
add in interface java.util.Collection<E extends RealmObject>add in interface java.util.List<E extends RealmObject>add in class java.util.AbstractList<E extends RealmObject>@Deprecated
public void add(int index,
E element)
add in interface java.util.List<E extends RealmObject>add in class java.util.AbstractList<E extends RealmObject>