Skip to content

Instantly share code, notes, and snippets.

@gokhanbarisaker
Created March 15, 2016 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gokhanbarisaker/aeba5fea363bb8fef42e to your computer and use it in GitHub Desktop.
Save gokhanbarisaker/aeba5fea363bb8fef42e to your computer and use it in GitHub Desktop.
naber lan?
Observable.from(new Loggable[]{ new Foo(), new Bar() }).subscribe(new Subscriber<Loggable>() {
@Override
public void onCompleted() {}
@Override
public void onError(Throwable e) {}
@Override
public void onNext(Loggable loggable) {
loggable.log();
}
});
interface Loggable {
void log();
}
class Foo implements Loggable {
@Override
public void log() {
Log.e("Foo", toString());
}
}
class Bar implements Loggable {
@Override
public void log() {
Log.e("Bar", toString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment