Created
March 15, 2016 13:27
-
-
Save gokhanbarisaker/aeba5fea363bb8fef42e to your computer and use it in GitHub Desktop.
naber lan?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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