Transformations

public class Transformations
extends Object

java.lang.Object
   ↳ androidx.lifecycle.Transformations


Transformation methods for LiveData.

These methods permit functional composition and delegation of LiveData instances. The transformations are calculated lazily, and will run only when the returned LiveData is observed. Lifecycle behavior is propagated from the input source LiveData to the returned one.

Summary

Public methods

static <X> LiveData<X> distinctUntilChanged(LiveData<X> source)

Creates a new LiveData object that does not emit a value until the source LiveData value has been changed.

static <X, Y> LiveData<Y> map(LiveData<X> source, Function<X, Y> mapFunction)

Returns a LiveData mapped from the input source LiveData by applying mapFunction to each value set on source.

static <X, Y> LiveData<Y> switchMap(LiveData<X> source, Function<X, LiveData<Y>> switchMapFunction)

Returns a LiveData mapped from the input source LiveData by applying switchMapFunction to each value set on source.

Inherited methods

Public methods

distinctUntilChanged

public static LiveData<X> distinctUntilChanged (