lifecycle/livedata/src/main/java/androidx/lifecycle/MediatorLiveData.java
@MainThread
    public <S> void addSource(@NonNull LiveData<S> source, @NonNull Observer<? super S> onChanged) {
        Source<S> e = new Source<>(source, onChanged);
        Source<?> existing = mSources.putIfAbsent(source, e);
        if (existing != null && existing.mObserver != onChanged) {
            throw new IllegalArgumentException(
                    "This source was already added with the different observer");
        }
        if (existing != null) {
            return;
        }
        if (hasActiveObservers()) {
            e.plug();
        }
    }
/**
     * Starts to listen the given {@code source} LiveData, {@code onChanged} observer will be called
     * when {@code source} value was changed.
     * <p>
     * {@code onChanged} callback will be called only when this {@code MediatorLiveData} is active.
     * <p> If the given LiveData is already added as a source but with a different Observer,
     * {@link IllegalArgumentException} will be thrown.
     *
     * @param source    the {@code LiveData} to listen to
     * @param onChanged The observer that will receive the events
     * @param <S>       The type of data hold by {@code source} LiveData
     */
Starts to listen the given  source LiveData,  onChanged observer will be called
when  source value was changed.

onChanged callback will be called only when this  MediatorLiveData is active.
 If the given LiveData is already added as a source but with a different Observer,
IllegalArgumentException will be thrown.

@param source    the  LiveData to listen to
@param onChanged The observer that will receive the events
@param        The type of data hold by  source LiveData
Starts to listen the given source LiveData onChanged observer will be called when source value was changed . onChanged callback will be called only when this MediatorLiveData is active . If the given LiveData is already added as a source but with a different Observer IllegalArgumentException will be thrown . @param source the LiveData to listen to @param onChanged The observer that will receive the events @param The type of data hold by source LiveData
@MainThread
    public <S> void addSource(@NonNull LiveData<S> source, @NonNull Observer<? super S> onChanged) {
        Source<S> e = new Source<>(source, onChanged);
        Source<?> existing = mSources.putIfAbsent(source, e);
        if (existing != null && existing.mObserver != onChanged) {
            throw new IllegalArgumentException(
                    "This source was already added with the different observer");
        }
        if (existing != null) {
            return;
        }
        if (hasActiveObservers()) {
            e.plug();
        }
    }
@ MainThread public < S > void addSource ( @ NonNull LiveData < S > source , @ NonNull Observer < ? super S > onChanged ) { Source < S > e = new Source < > ( source , onChanged ) ; Source < ? > existing = mSources . putIfAbsent ( source , e ) ; if ( existing != null && existing . mObserver != onChanged ) { throw new IllegalArgumentException ( "This source was already added with the different observer" ) ; } if ( existing != null ) { return ; } if ( hasActiveObservers ( ) ) { e . plug ( ) ; } }
Starts to listen the given {@code source} LiveData, {@code onChanged} observer will be called
 when {@code source} value was changed.
Starts to listen the given { @code source } LiveData { @code onChanged } observer will be called when { @code source } value was changed .