package io.github.droidkaigi.confsched2017.viewmodel;

import android.databinding.BaseObservable;
import android.support.annotation.NonNull;

import java.util.List;

import javax.inject.Inject;

import io.github.droidkaigi.confsched2017.model.Contributor;
import io.github.droidkaigi.confsched2017.repository.contributors.ContributorsRepository;
import io.reactivex.Single;

public final class ContributorsViewModel extends BaseObservable implements ViewModel {

    private final ContributorsRepository contributorsRepository;

    private Callback callback;

    @Inject
    ContributorsViewModel(ContributorsRepository contributorsRepository) {
        this.contributorsRepository = contributorsRepository;
    }

    public void setCallback(@NonNull Callback callback) {
        this.callback = callback;
    }

    @Override
    public void destroy() {
        this.callback = null;
    }

    public interface Callback {

        void onClickContributor(Contributor contributor);
    }

    public Single<List<ContributorViewModel>> getContributors() {
        return contributorsRepository.findAll().map(contributors ->
                Stream.of(contributors).map(ContributorViewModel::new)
                        .collect(Collectors.toList()));
    }
}

@@ -59,85 +59,115 @@
 ort 
-android.databinding.BaseObservable;%0Aimport android.sup
+com.annimon.stream.Collectors;%0Aimport com.annimon.stream.Stream;%0A%0Aim
 port
-.annotation.NonNull
+ android.databinding.BaseObservable
 ;%0A%0Ai
@@ -222,69 +222,8 @@
 t;%0A%0A
-import io.github.droidkaigi.confsched2017.model.Contributor;%0A
 impo
@@ -495,40 +495,8 @@
 y;%0A%0A
-    private Callback callback;%0A%0A
     
@@ -655,272 +655,45 @@
     
-public void setCallback(@NonNull Callback callback) %7B%0A        this.callback = callback;%0A    %7D%0A%0A    @Override%0A    public void destroy() %7B%0A        this.callback = null;%0A    %7D%0A%0A    public interface Callback %7B%0A%0A        void onClickContributor(Contributor contributor);
+@Override%0A    public void destroy() %7B
 %0A   

Remove callback from ContributorsViewModel