This file contains 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
public Observable<Response> upload(final Image image) { | |
// create new ArrayList in case if image.getChunks() returns immutable collection | |
final List<Chunk> chunks = new ArrayList<Chunk>(image.getChunks()); | |
if (chunks.isEmpty()) { | |
return Observable.empty(); | |
} | |
if (chunks.size() == 1) { | |
return api.upload(chunks.get(0)); |
This file contains 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
final Observable<MyDatum> observable = Observable.interval(10, TimeUnit.SECONDS).flatMap(new Func1<Long, Observable<MyDatum>>() { | |
@Override | |
public Observable<MyDatum> call(final Long counter) { | |
return db.select("SELECT f1,f2 FROM mydata") | |
.autoMap(MyDatum.class) | |
.doOnNext(new Action1<MyDatum>() { | |
@Override | |
public void call(final MyDatum value) { | |
state.add(value); | |
} |
This file contains 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
public class Main { | |
public static void main(String[] args) { | |
ContentManager cm = new ContentManager(); | |
Observable | |
.from(cm.getPermalinks(10)) | |
.flatMap(permalink -> Observable.zip( | |
Observable.<Content>create(subscriber -> cm.getDataByPermalink(permalink, new SubscribingRestCallback(subscriber))), | |
Observable.<Content>create(subscriber -> cm.getStreamByPermalink(permalink, new SubscribingRestCallback(subscriber))), | |
(dataContent, streamUrlContent) -> { |
This file contains 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
public class Main { | |
public static void main(final String[] args) throws Exception { | |
Observable.from(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12)) | |
.groupBy(item -> item % 4) | |
.flatMap(Observable::toList) | |
.filter(integers -> integers.size() > 2) | |
.toList() | |
.subscribe(result -> { | |
System.out.printf("%d results %s%n", result.size(), result); | |
}); |
This file contains 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
public final class OperatorThrottleList<T> implements Operator<T, List<T>> { | |
private final Scheduler scheduler; | |
private final long interval; | |
public OperatorThrottleList(final long interval, final TimeUnit unit, final Scheduler scheduler) { | |
this.interval = unit.toMillis(interval); | |
this.scheduler = scheduler; | |
} | |
@Override |
This file contains 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
public class StackOverflow { | |
public static void main(String[] args) { | |
final Observable<Integer> firstObs = Observable.just(1, 2, 3, 4, 5); | |
final Observable<Integer> secondObs = Observable.just(2, 4, 6); | |
final Observable<Integer> result = secondObs.toList().flatMap(new Func1<List<Integer>, Observable<Integer>>() { | |
@Override | |
public Observable<Integer> call(final List<Integer> ignore) { | |
return firstObs.filter(new Func1<Integer, Boolean>() { | |
@Override |
This file contains 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
<T:Ljava/lang/Object;A:[TT;>(TA;I)TA; |
This file contains 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
final class com/github/vmironov/MainKt$main$first$1 extends kotlin/jvm/internal/FunctionReference implements kotlin/jvm/functions/Function2 { | |
// access flags 0x1041 | |
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; | |
ALOAD 0 | |
ALOAD 1 | |
CHECKCAST com/github/vmironov/A | |
ALOAD 2 | |
CHECKCAST java/lang/Number | |
INVOKEVIRTUAL java/lang/Number.intValue ()I | |
INVOKEVIRTUAL com/github/vmironov/MainKt$main$first$1.invoke (Lcom/github/vmironov/A;I)I |
This file contains 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
class AccountViewModel : ObservableModel by ObservableModelDelegate() { | |
@get:Bindable var name by property<CharSequence>("", BR.name) | |
@get:Bindable var authenticated by property(false, BR.authenticated) | |
@get:Bindable var avatar by property("", BR.avatar) | |
} |
This file contains 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
package com.github.vmironov | |
import kotlin.reflect.jvm.internal.impl.serialization.ClassData | |
import kotlin.reflect.jvm.internal.impl.serialization.Flags | |
import kotlin.reflect.jvm.internal.impl.serialization.ProtoBuf | |
import kotlin.reflect.jvm.internal.impl.serialization.jvm.JvmProtoBufUtil | |
data class Foo(val foo: String) | |
data class Bar(val bar: String) |
OlderNewer