io.realm
Implemented interfaces:
RealmList is used to model one-to-many relationships in a io.realm.RealmObject . RealmList has two modes: A managed and unmanaged mode. In managed mode all objects are persisted inside a Realm, in unmanaged mode it works as a normal ArrayList.
Only Realm can create managed RealmLists. Managed RealmLists will automatically update the content whenever the underlying Realm is updated, and can only be accessed using the getter of a io.realm.RealmObject .
El usuario puede crear listas de dominios no administradas que contengan objetos de dominio administrados y no administrados. Esto resulta útil al trabajar con deserializadores JSON como GSON u otros frameworks que inyectan valores en una clase. Los elementos no administrados de esta lista se pueden agregar a un dominio mediante el método Realm.copyToRealm(Iterable, ImportFlag...).
RealmList puede contener más elementos que Integer.MAX_VALUE En ese caso, solo podrá acceder a los primeros Integer.MAX_VALUE elementos.
Constructores
Field Summary
Modificador y Tipo | Campo y Descripción |
|---|---|
public final BaseRealm | The BaseRealm instance in which this list resides. Warning: This field is only exposed for internal usage, and should not be used. |
Resumen del método
Modificador y Tipo | Método y descripción |
|---|---|
public booleano | Adds the specified object at the end of this List. |
public void | Inserts the specified object into this List at the specified location. |
public void | Agrega un listener de cambios a este RealmList . |
public void | Agrega un listener de cambios a este RealmList . |
public <any> | Returns an Rx Observable that monitors changes to this RealmList. |
public <any> | asFlowable () Devuelve un Rx Flowable que monitorea los cambios en esta RealmList. |
public double | |
public void | clear () Removes all elements from this list, leaving it empty. |
public booleano | |
Creates a snapshot from this OrderedRealmCollection . | |
public booleano | This deletes all objects in the collection from the underlying Realm as well as from the collection. |
public booleano | Deletes the first object from the Realm. |
public void | Deletes the object at the given index from the Realm. |
public booleano | Elimina el último objeto del Reino. |
public E | Gets the first object from the collection. |
public E | first () Gets the first object from the collection. |
public RealmList | freeze () |
public E | Returns the element at the specified location in this list. |
public Realm | |
public booleano | isFrozen () |
public booleano | isLoaded () Checks if a collection has finished loading its data yet. |
public booleano | isManaged () Checks if the collection is managed by Realm. |
public booleano | isValid () Checks if the collection is still valid to use, i.e., the io.realm.Realm instance hasn't been closed. |
public Iterator | iterator () |
public E | Gets the last object from the collection. |
public E | last () Gets the last object from the collection. |
public ListIterator | |
public ListIterator | listIterator () |
public booleano | load () Bloquea la recopilación hasta que todos los datos estén disponibles. |
public Number | |
public Date | |
public Number | |
public Date | |
public void | Mueve un objeto de una posición a otra, manteniendo una lista de tamaño fijo. |
public booleano | |
public E | Removes the object at the specified location from this list. |
public booleano | Removes all occurrences in this |
public void | Removes all user-defined change listeners. |
public void | Removes the specified change listener. |
public void | ) Removes the specified change listener. |
public E | Reemplaza el elemento en la ubicación especificada en esta lista con el objeto especificado. |
public int | size () Returns the number of elements in this |
public RealmResults | Ordena una colección en función de los campos y órdenes de clasificación enviados. |
public RealmResults | |
public RealmResults | |
public RealmResults | |
public Number | |
public String | toString () |
where () Returns a RealmQuery, which can be used to query for specific objects of this class. |
Inherited Methods
Methods inherited from class java.lang.Object :
getClass,hashCode,equals,clone,toString,notify,notifyAll,wait,wait,wait,finalizeMethods inherited from class java.util.AbstractCollection :
iterator,size,isEmpty,contains,toArray,toArray,add,remove,containsAll,addAll,removeAll,retainAll,clear,toStringMethods inherited from class java.util.AbstractList :
add,get,set,add,remove,indexOf,lastIndexOf,clear,addAll,iterator,listIterator,listIterator,subList,equals,hashCode,removeRange
Detalle del Campo
baseRealm
The BaseRealm instance in which this list resides.
Warning: This field is only exposed for internal usage, and should not be used.
Detalle del constructor
public RealmList () |
|---|
Creates a RealmList in unmanaged mode, where the elements are not controlled by a Realm. This effectively makes the RealmList function as a java.util.ArrayList and it is not possible to query the objects in this state. Utilice io.realm.Realm.copyToRealm(Iterable, ImportFlag...) para que sus elementos persistan correctamente en Realm. |
Creates a RealmList in unmanaged mode with an initial list of elements. A RealmList in unmanaged mode function as a java.util.ArrayList and it is not possible to query the objects in this state. Utilice io.realm.Realm.copyToRealm(Iterable, ImportFlag...) para conservar correctamente todos los elementos no administrados en Realm. Parámetros
|
Detalle del método
add
Adds the specified object at the end of this List.
Parámetros
Devuelve siempre Throws
Anulaciones
|
Inserts the specified object into this List at the specified location. The object is inserted before any previous element at the specified location. If the location is equal to the size of this List, the object is added at the end.
Parámetros
Throws
Anulaciones
|
addChangeListener
Agrega un listener de cambios a este RealmList . Registrar un detector de cambios no impedirá que la RealmList subyacente sea objeto de recolección de basura. Si se realiza la recolección de basura de la RealmList, el detector de cambios dejará de activarse. Para evitar esto, mantenga una referencia fuerte durante el tiempo que sea necesario, por ejemplo, en una variable de clase. Parámetros
Throws
|
public void addChangeListener ( ) | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Agrega un listener de cambios a este RealmList . Registrar un detector de cambios no impedirá que la RealmList subyacente sea objeto de recolección de basura. Si se realiza la recolección de basura de la RealmList, el detector de cambios dejará de activarse. Para evitar esto, mantenga una referencia fuerte durante el tiempo que sea necesario, por ejemplo, en una variable de clase. Parámetros
Throws
|
asChangesetObservable
public <any> asChangesetObservable () | |||||
|---|---|---|---|---|---|
Returns an Rx Observable that monitors changes to this RealmList. It will emit the current RealmList when subscribed. For each update to the RealmList a pair consisting of the RealmList and the OrderedCollectionChangeSet will be sent. The changeset will be RealmList will continually be emitted as the RealmList is updated - Los elementos emitidos por Realm Observables están congelados (consulta freeze() ). Esto significa que son inmutables y se pueden leer en cualquier hilo. Realm Observables always emit items from the thread holding the live Realm. This means that if you need to do further processing, it is recommend to observe the values on a computation scheduler: Devuelve Observable de RxJava que solo llama a Throws
|
asFlowable
public <any> asFlowable () | ||||||||
|---|---|---|---|---|---|---|---|---|
Returns an Rx Flowable that monitors changes to this RealmList. It will emit the current RealmList when subscribed to. RealmList will continually be emitted as the RealmList is updated - Los elementos emitidos desde Realm Flowables están congelados (ver freeze()). Esto significa que son inmutables y se pueden leer en cualquier hilo. Realm Flowables always emit items from the thread holding the live RealmList. This means that if you need to do further processing, it is recommend to observe the values on a computation scheduler: If you would like the Devuelve Observable de RxJava que solo llama a Throws
|
average
Devuelve el promedio de un campo dado. Devuelve el promedio del campo indicado entre los objetos de los resultados de la query. Esto será del tipo double para todos los campos de tipo numérico. Si no existen objetos o todos tienen |
borrar
public void clear () |
|---|
Remueve todos los elementos de esta lista, dejándola vacía. Este método no remueve los objetos del Realm. Throws
Anulaciones
|
contiene
Returns If the list is not attached to a Realm, the default List.contains(Object) implementation will occur. Parámetros
Devuelve
Anulaciones
|
createSnapshot
public OrderedRealmCollectionSnapshot createSnapshot () |
|---|
deleteAllFromRealm
public boolean deleteAllFromRealm () |
|---|
This deletes all objects in the collection from the underlying Realm as well as from the collection. Devuelve
|
eliminarPrimeroDelReino
public boolean deleteFirstFromRealm () |
|---|
Deletes the first object from the Realm. This also removes it from this collection. Devuelve
|
deleteFromRealm
Deletes the object at the given index from the Realm. This also removes it from the collection. |
deleteLastFromRealm
public boolean deleteLastFromRealm () |
|---|
Elimina el último objeto del dominio. Esto también lo elimina de esta colección. Devuelve
|
primero
Gets the first object from the collection. If the collection is empty, the provided default will be used instead. Devuelve the first object or the provided default. |
public E first () |
|---|
Gets the first object from the collection. Devuelve the first object. |
freeze
Obtener
Returns the element at the specified location in this list. Parámetros
Devuelve the element at the specified index. Throws
Anulaciones
|
getRealm
Devuelve la instancia de Realm a la que pertenece esta colección. Calling Realm.close() on the returned instance is discouraged as it is the same as calling it on the original Realm instance which may cause the Realm to fully close invalidating the list. Devuelve Realm instance this collection belongs to or Throws
|
isFrozen
public boolean isFrozen () |
|---|
isLoaded
public boolean isLoaded () |
|---|
Checks if a collection has finished loading its data yet. Devuelve
|
esGestionado
public boolean isManaged () |
|---|
Checks if the collection is managed by Realm. A managed collection is just a wrapper around the data in the underlying Realm file. On Looper threads, a managed collection will be live-updated so it always points to the latest data. Managed collections are thread confined so that they cannot be accessed from other threads than the one that created them.If this method returns Devuelve
|
isValid
public boolean isValid () |
|---|
Checks if the collection is still valid to use, i.e., the io.realm.Realm instance hasn't been closed. It will always return Devuelve
|
iterador
Anulaciones
|
último
Gets the last object from the collection. If the collection is empty, the provided default will be used instead. Devuelve the last object or the provided default. |
public E last () |
|---|
Gets the last object from the collection. Devuelve the last object. |
listIterator
Anulaciones
|
public ListIterator listIterator () |
|---|
Anulaciones
|
carga
public boolean load () |
|---|
Bloquea la recopilación hasta que todos los datos estén disponibles. Devuelve
|
máximo
fecha máxima
min
minDate
mover
Mueve un objeto de una posición a otra, manteniendo una lista de tamaño fijo. Los RealmObjects se desplazarán para que no se introduzcan valores Parámetros
Throws
|
Remover
Elimina una instancia del objeto especificado de este Parámetros
Devuelve
Throws
Anulaciones
|
Removes the object at the specified location from this list. Parámetros
Devuelve the removed object. Throws
Anulaciones
|
Remover todo
Elimina todas las ocurrencias en este Esta implementación itera sobre el Parámetros
Devuelve
Throws
Anulaciones
|
removeAllChangeListeners
public void removeAllChangeListeners () |
|---|
Removes all user-defined change listeners. Throws
|
removeChangeListener
Removes the specified change listener. Parámetros
Throws
|
public void removeChangeListener ( ) |
|---|
Removes the specified change listener. Parámetros
Throws
|
conjunto
Reemplaza el elemento en la ubicación especificada en esta lista con el objeto especificado.
Parámetros
Devuelve el elemento anterior en el índice. Throws
Anulaciones
|
tamaño
public int size () |
|---|
Returns the number of elements in this Devuelve El número de elementos en este Throws
Anulaciones
|
sort
Ordena una colección en función de los campos y órdenes de clasificación enviados. Devuelve se creará y devolverá un nuevo RealmResults ordenado. La colección original permanece sin cambios. |
Ordena una colección en función de los campos y órdenes de clasificación enviados. Devuelve se creará y devolverá un nuevo RealmResults ordenado. La colección original permanece sin cambios. |
Sorts a collection based on the provided field and sort order. Devuelve se creará y devolverá un nuevo RealmResults ordenado. La colección original permanece sin cambios. |
Ordena una colección según el campo proporcionado en orden ascendente. Devuelve se creará y devolverá un nuevo RealmResults ordenado. La colección original permanece sin cambios. |
suma
toString
Anulaciones
|
dónde
public RealmQuery where () |
|---|
Returns a RealmQuery, which can be used to query for specific objects of this class. Devuelve un objeto de RealmQuery. Throws
|