E - The class of objects to be queriedpublic class RealmQuery<E extends RealmObject>
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
static boolean | 
CASE_INSENSITIVE  | 
static boolean | 
CASE_SENSITIVE  | 
| Constructor and Description | 
|---|
RealmQuery(Realm realm,
          java.lang.Class<E> clazz)
Creating a RealmQuery instance. 
 | 
RealmQuery(RealmResults realmList,
          java.lang.Class<E> clazz)
Create a RealmQuery instance from a @{link io.realm.RealmResults}. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
double | 
averageDouble(java.lang.String fieldName)
Calculate the average of a field 
 | 
double | 
averageFloat(java.lang.String fieldName)
Calculate the average of a field 
 | 
double | 
averageInt(java.lang.String fieldName)
Calculate the average of a field 
 | 
RealmQuery<E> | 
beginGroup()
Begin grouping of conditions ("left parenthesis") 
 | 
RealmQuery<E> | 
beginsWith(java.lang.String fieldName,
          java.lang.String value)
Condition that the value of field begins with the specified string 
 | 
RealmQuery<E> | 
beginsWith(java.lang.String fieldName,
          java.lang.String value,
          boolean caseSensitive)
Condition that the value of field begins with the specified substring 
 | 
RealmQuery<E> | 
between(java.lang.String fieldName,
       java.util.Date from,
       java.util.Date to)
Between condition 
 | 
RealmQuery<E> | 
between(java.lang.String fieldName,
       double from,
       double to)
Between condition 
 | 
RealmQuery<E> | 
between(java.lang.String fieldName,
       float from,
       float to)
Between condition 
 | 
RealmQuery<E> | 
between(java.lang.String fieldName,
       int from,
       int to)
Between condition 
 | 
RealmQuery<E> | 
between(java.lang.String fieldName,
       long from,
       long to)
Between condition 
 | 
RealmQuery<E> | 
contains(java.lang.String fieldName,
        java.lang.String value)
Condition that value of field contains the specified substring 
 | 
RealmQuery<E> | 
contains(java.lang.String fieldName,
        java.lang.String value,
        boolean caseSensitive)
Condition that value of field contains the specified substring 
 | 
long | 
count()
Count the number of objects that fulfill the query conditions. 
 | 
RealmQuery<E> | 
endGroup()
End grouping of conditions ("right parenthesis") 
 | 
RealmQuery<E> | 
endsWith(java.lang.String fieldName,
        java.lang.String value)
Condition that the value of field ends with the specified string 
 | 
RealmQuery<E> | 
endsWith(java.lang.String fieldName,
        java.lang.String value,
        boolean caseSensitive)
Condition that the value of field ends with the specified substring 
 | 
RealmQuery<E> | 
equalTo(java.lang.String fieldName,
       boolean value)
Equal-to comparison 
 | 
RealmQuery<E> | 
equalTo(java.lang.String fieldName,
       java.util.Date value)
Equal-to comparison 
 | 
RealmQuery<E> | 
equalTo(java.lang.String fieldName,
       double value)
Equal-to comparison 
 | 
RealmQuery<E> | 
equalTo(java.lang.String fieldName,
       float value)
Equal-to comparison 
 | 
RealmQuery<E> | 
equalTo(java.lang.String fieldName,
       int value)
Equal-to comparison 
 | 
RealmQuery<E> | 
equalTo(java.lang.String fieldName,
       long value)
Equal-to comparison 
 | 
RealmQuery<E> | 
equalTo(java.lang.String fieldName,
       java.lang.String value)
Equal-to comparison 
 | 
RealmQuery<E> | 
equalTo(java.lang.String fieldName,
       java.lang.String value,
       boolean caseSensitive)
Equal-to comparison 
 | 
RealmResults<E> | 
findAll()
Find all objects that fulfill the query conditions. 
 | 
RealmResults<E> | 
findAll(java.lang.String fieldName,
       boolean sortAscending)
Find all objects that fulfill the query conditions and sorted by specific field name. 
 | 
E | 
findFirst()
Find the first object that fulfills the query conditions. 
 | 
RealmQuery<E> | 
greaterThan(java.lang.String fieldName,
           java.util.Date value)
Greater-than comparison 
 | 
RealmQuery<E> | 
greaterThan(java.lang.String fieldName,
           double value)
Greater-than comparison 
 | 
RealmQuery<E> | 
greaterThan(java.lang.String fieldName,
           float value)
Greater-than comparison 
 | 
RealmQuery<E> | 
greaterThan(java.lang.String fieldName,
           int value)
Greater-than comparison 
 | 
RealmQuery<E> | 
greaterThan(java.lang.String fieldName,
           long value)
Greater-than comparison 
 | 
RealmQuery<E> | 
greaterThanOrEqualTo(java.lang.String fieldName,
                    java.util.Date value)
Greater-than-or-equal-to comparison 
 | 
RealmQuery<E> | 
greaterThanOrEqualTo(java.lang.String fieldName,
                    double value)
Greater-than-or-equal-to comparison 
 | 
RealmQuery<E> | 
greaterThanOrEqualTo(java.lang.String fieldName,
                    float value)
Greater-than-or-equal-to comparison 
 | 
RealmQuery<E> | 
greaterThanOrEqualTo(java.lang.String fieldName,
                    int value)
Greater-than-or-equal-to comparison 
 | 
RealmQuery<E> | 
greaterThanOrEqualTo(java.lang.String fieldName,
                    long value)
Greater-than-or-equal-to comparison 
 | 
RealmQuery<E> | 
lessThan(java.lang.String fieldName,
        java.util.Date value)
Less-than comparison 
 | 
RealmQuery<E> | 
lessThan(java.lang.String fieldName,
        double value)
Less-than comparison 
 | 
RealmQuery<E> | 
lessThan(java.lang.String fieldName,
        float value)
Less-than comparison 
 | 
RealmQuery<E> | 
lessThan(java.lang.String fieldName,
        int value)
Less-than comparison 
 | 
RealmQuery<E> | 
lessThan(java.lang.String fieldName,
        long value)
Less-than comparison 
 | 
RealmQuery<E> | 
lessThanOrEqualTo(java.lang.String fieldName,
                 java.util.Date value)
Less-than-or-equal-to comparison 
 | 
RealmQuery<E> | 
lessThanOrEqualTo(java.lang.String fieldName,
                 double value)
Less-than-or-equal-to comparison 
 | 
RealmQuery<E> | 
lessThanOrEqualTo(java.lang.String fieldName,
                 float value)
Less-than-or-equal-to comparison 
 | 
RealmQuery<E> | 
lessThanOrEqualTo(java.lang.String fieldName,
                 int value)
Less-than-or-equal-to comparison 
 | 
RealmQuery<E> | 
lessThanOrEqualTo(java.lang.String fieldName,
                 long value)
Less-than-or-equal-to comparison 
 | 
java.util.Date | 
maximumDate(java.lang.String fieldName)
Find the maximum value of a field 
 | 
double | 
maximumDouble(java.lang.String fieldName)
Find the maximum value of a field 
 | 
float | 
maximumFloat(java.lang.String fieldName)
Find the maximum value of a field 
 | 
long | 
maximumInt(java.lang.String fieldName)
Find the maximum value of a field 
 | 
java.util.Date | 
minimumDate(java.lang.String fieldName)
Find the minimum value of a field 
 | 
double | 
minimumDouble(java.lang.String fieldName)
Find the minimum value of a field 
 | 
float | 
minimumFloat(java.lang.String fieldName)
Find the minimum value of a field 
 | 
long | 
minimumInt(java.lang.String fieldName)
Find the minimum value of a field 
 | 
RealmQuery<E> | 
notEqualTo(java.lang.String fieldName,
          boolean value)
Not-equal-to comparison 
 | 
RealmQuery<E> | 
notEqualTo(java.lang.String fieldName,
          java.util.Date value)
Not-equal-to comparison 
 | 
RealmQuery<E> | 
notEqualTo(java.lang.String fieldName,
          double value)
Not-equal-to comparison 
 | 
RealmQuery<E> | 
notEqualTo(java.lang.String fieldName,
          float value)
Not-equal-to comparison 
 | 
RealmQuery<E> | 
notEqualTo(java.lang.String fieldName,
          int value)
Not-equal-to comparison 
 | 
RealmQuery<E> | 
notEqualTo(java.lang.String fieldName,
          long value)
Not-equal-to comparison 
 | 
RealmQuery<E> | 
notEqualTo(java.lang.String fieldName,
          java.lang.String value)
Not-equal-to comparison 
 | 
RealmQuery<E> | 
notEqualTo(java.lang.String fieldName,
          java.lang.String value,
          boolean caseSensitive)
Not-equal-to comparison 
 | 
RealmQuery<E> | 
or()
Logical-or two conditions 
 | 
double | 
sumDouble(java.lang.String fieldName)
Calculate the sum of a field 
 | 
double | 
sumFloat(java.lang.String fieldName)
Calculate the sum of a field 
 | 
long | 
sumInt(java.lang.String fieldName)
Calculate the sum of a field 
 | 
public static final boolean CASE_SENSITIVE
public static final boolean CASE_INSENSITIVE
public RealmQuery(Realm realm, java.lang.Class<E> clazz)
realm - The realm to query within.clazz - The class to query.java.lang.RuntimeException - Any other error.public RealmQuery(RealmResults realmList, java.lang.Class<E> clazz)
realmList - The @{link io.realm.RealmResults} to queryclazz - The class to queryjava.lang.RuntimeException - Any other errorpublic RealmQuery<E> equalTo(java.lang.String fieldName, java.lang.String value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> equalTo(java.lang.String fieldName, java.lang.String value, boolean caseSensitive)
fieldName - The field to comparevalue - The value to compare withcaseSensitive - if true, substring matching is case sensitivejava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> equalTo(java.lang.String fieldName, int value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> equalTo(java.lang.String fieldName, long value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> equalTo(java.lang.String fieldName, double value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> equalTo(java.lang.String fieldName, float value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> equalTo(java.lang.String fieldName, boolean value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> equalTo(java.lang.String fieldName, java.util.Date value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> notEqualTo(java.lang.String fieldName, java.lang.String value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> notEqualTo(java.lang.String fieldName, java.lang.String value, boolean caseSensitive)
fieldName - The field to comparevalue - The value to compare withcaseSensitive - if true, substring matching is case sensitivejava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> notEqualTo(java.lang.String fieldName, int value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> notEqualTo(java.lang.String fieldName, long value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> notEqualTo(java.lang.String fieldName, double value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> notEqualTo(java.lang.String fieldName, float value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> notEqualTo(java.lang.String fieldName, boolean value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> notEqualTo(java.lang.String fieldName, java.util.Date value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> greaterThan(java.lang.String fieldName, int value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> greaterThan(java.lang.String fieldName, long value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> greaterThan(java.lang.String fieldName, double value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> greaterThan(java.lang.String fieldName, float value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> greaterThan(java.lang.String fieldName, java.util.Date value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> greaterThanOrEqualTo(java.lang.String fieldName, int value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> greaterThanOrEqualTo(java.lang.String fieldName, long value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> greaterThanOrEqualTo(java.lang.String fieldName, double value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> greaterThanOrEqualTo(java.lang.String fieldName, float value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> greaterThanOrEqualTo(java.lang.String fieldName, java.util.Date value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> lessThan(java.lang.String fieldName, int value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> lessThan(java.lang.String fieldName, long value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> lessThan(java.lang.String fieldName, double value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> lessThan(java.lang.String fieldName, float value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> lessThan(java.lang.String fieldName, java.util.Date value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> lessThanOrEqualTo(java.lang.String fieldName, int value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> lessThanOrEqualTo(java.lang.String fieldName, long value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> lessThanOrEqualTo(java.lang.String fieldName, double value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> lessThanOrEqualTo(java.lang.String fieldName, float value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> lessThanOrEqualTo(java.lang.String fieldName, java.util.Date value)
fieldName - The field to comparevalue - The value to compare withjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> between(java.lang.String fieldName, int from, int to)
fieldName - The field to comparefrom - Lowest value (inclusive)to - Highest value (inclusive)java.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> between(java.lang.String fieldName, long from, long to)
fieldName - The field to comparefrom - Lowest value (inclusive)to - Highest value (inclusive)java.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> between(java.lang.String fieldName, double from, double to)
fieldName - The field to comparefrom - Lowest value (inclusive)to - Highest value (inclusive)java.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> between(java.lang.String fieldName, float from, float to)
fieldName - The field to comparefrom - Lowest value (inclusive)to - Highest value (inclusive)java.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> between(java.lang.String fieldName, java.util.Date from, java.util.Date to)
fieldName - The field to comparefrom - Lowest value (inclusive)to - Highest value (inclusive)java.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> contains(java.lang.String fieldName, java.lang.String value)
fieldName - The field to comparevalue - The substringjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> contains(java.lang.String fieldName, java.lang.String value, boolean caseSensitive)
fieldName - The field to comparevalue - The substringcaseSensitive - if true, substring matching is case sensitivejava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> beginsWith(java.lang.String fieldName, java.lang.String value)
fieldName - The field to comparevalue - The stringjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> beginsWith(java.lang.String fieldName, java.lang.String value, boolean caseSensitive)
fieldName - The field to comparevalue - The substringcaseSensitive - if true, substring matching is case sensitivejava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> endsWith(java.lang.String fieldName, java.lang.String value)
fieldName - The field to comparevalue - The stringjava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> endsWith(java.lang.String fieldName, java.lang.String value, boolean caseSensitive)
fieldName - The field to comparevalue - The substringcaseSensitive - if true, substring matching is case sensitivejava.lang.IllegalArgumentException - One or more arguments do not match class or
 field typejava.lang.RuntimeException - Any other errorpublic RealmQuery<E> beginGroup()
java.lang.RuntimeException - Any other errorpublic RealmQuery<E> endGroup()
java.lang.RuntimeException - Any other errorpublic RealmQuery<E> or()
java.lang.RuntimeException - Any other errorpublic long sumInt(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public double sumDouble(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public double sumFloat(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public double averageInt(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public double averageDouble(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public double averageFloat(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public long minimumInt(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public double minimumDouble(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public float minimumFloat(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public java.util.Date minimumDate(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public long maximumInt(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public double maximumDouble(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public float maximumFloat(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public java.util.Date maximumDate(java.lang.String fieldName)
fieldName - The field namejava.lang.UnsupportedOperationException - The query is not valid ("syntax error")public long count()
java.lang.UnsupportedOperationException - The query is not valid ("syntax error")public RealmResults<E> findAll()
java.lang.RuntimeException - Any other errorRealmResultspublic RealmResults<E> findAll(java.lang.String fieldName, boolean sortAscending)
fieldName - the field name to sort by.sortAscending - sort ascending if SORT_ORDER_ASCENDING, sort descending if SORT_ORDER_DESCENDING.java.lang.IllegalArgumentException - if field name does not exist.public E findFirst()
java.lang.RuntimeException - Any other error.RealmObject