本文整理汇总了Java中io.reactivex.Observable.fromArray方法的典型用法代码示例。如果您正苦于以下问题:Java Observable.fromArray方法的具体用法?Java Observable.fromArray怎么用?Java Observable.fromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.Observable
的用法示例。
在下文中一共展示了Observable.fromArray方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doSomeWork
import io.reactivex.Observable; //导入方法依赖的package包/类
private void doSomeWork() {
final String[] aStrings = {"A1", "A2", "A3", "A4"};
final String[] bStrings = {"B1", "B2", "B3"};
final Observable<String> aObservable = Observable.fromArray(aStrings);
final Observable<String> bObservable = Observable.fromArray(bStrings);
Observable.concat(aObservable, bObservable)
.subscribe(getObserver());
}
示例2: doSomeWork
import io.reactivex.Observable; //导入方法依赖的package包/类
private void doSomeWork() {
final String[] aStrings = {"A1", "A2", "A3", "A4"};
final String[] bStrings = {"B1", "B2", "B3"};
final Observable<String> aObservable = Observable.fromArray(aStrings);
final Observable<String> bObservable = Observable.fromArray(bStrings);
Observable.merge(aObservable, bObservable)
.subscribe(getObserver());
}
示例3: main
import io.reactivex.Observable; //导入方法依赖的package包/类
public static void main(String[] args) {
// TODO Auto-generated method stub
Observable names1 = Observable.fromArray(new String[] { "name1", "abc", "xyz", "lmn" });
Observable names2 = Observable.fromArray(new String[] { "name1", "abc", "xyz", "lmn" });
Observable.sequenceEqual(names1, names2).subscribe(new SingleObserver<Boolean>() {
@Override
public void onError(Throwable throwable) {
// TODO Auto-generated method stub
System.out.println(throwable.getMessage());
}
@Override
public void onSubscribe(Disposable disposable) {
// TODO Auto-generated method stub
System.out.println("is disposed:-" + disposable.isDisposed());
}
@Override
public void onSuccess(Boolean value) {
// TODO Auto-generated method stub
if (value) {
System.out
.println("successfully finished comparision of two sequence and both sequences are equal");
}
else
System.out.println("successfully finished comparision of two sequence and both sequences are NOT equal");
}
});
}
示例4: doSomeWork
import io.reactivex.Observable; //导入方法依赖的package包/类
/**
* Concat操作符将多个Observable结合成一个Observable并发射数据,并且严格按照先后顺序发射数据,
* 前一个Observable的数据没有发射完,是不能发射后面Observable的数据的。
*/
private void doSomeWork() {
final String[] aStrings = {"A1", "A2", "A3", "A4"};
final String[] bStrings = {"B1", "B2", "B3"};
final Observable<String> aObservable = Observable.fromArray(aStrings);
final Observable<String> bObservable = Observable.fromArray(bStrings);
Observable.concat(aObservable, bObservable)
.subscribe(getObserver());
}
示例5: doSomeWork
import io.reactivex.Observable; //导入方法依赖的package包/类
private void doSomeWork() {
final String[] aStrings = {"A1", "A2", "A3", "A4"};
final String[] bStrings = {"B1", "B2", "B3"};
final Observable<String> aObservable = Observable.fromArray(aStrings);
final Observable<String> bObservable = Observable.fromArray(bStrings);
aObservable.startWith(bObservable)
.subscribe(getObserver());
}
示例6: doSomeWork
import io.reactivex.Observable; //导入方法依赖的package包/类
private void doSomeWork() {
final String[] aStrings = {"A1", "A2", "A3", "A4"};
final String[] bStrings = {"B1", "B2", "B3"};
final Observable<String> aObservable = Observable.fromArray(aStrings);
final Observable<String> bObservable = Observable.fromArray(bStrings);
Observable.combineLatest(aObservable, bObservable, new BiFunction<String, String, String>() {
@Override
public String apply(@NonNull String s, @NonNull String s2) throws Exception {
return s + "-" + s2;
}
}).subscribe(getObserver());
}
示例7: observable
import io.reactivex.Observable; //导入方法依赖的package包/类
@Override
public Observable<T> observable() {
return Observable.fromArray(get());
}
示例8: getRollNumber
import io.reactivex.Observable; //导入方法依赖的package包/类
Observable<Integer> getRollNumber() {
return Observable.fromArray(12, 15, 63, 15, 54, 92);
}
示例9: main
import io.reactivex.Observable; //导入方法依赖的package包/类
public static void main(String[] args) {
Integer[] numbers = { 1, 2, 13, 34, 12, 10 };
Observable<Integer> source1 = Observable.fromArray(numbers);
source1.reduce(new BiFunction<Integer, Integer, Integer>() {
@Override
public Integer apply(Integer value1, Integer value2) throws Exception {
// TODO Auto-generated method stub
// 1, 2, 13, 34, 12, 10
int sum = 0;
return value1 + value2;
}
}).subscribe(new MaybeObserver<Integer>() {
@Override
public void onComplete() {
// TODO Auto-generated method stub
System.out.println("completed2");
}
@Override
public void onError(Throwable throwable) {
// TODO Auto-generated method stub
System.out.println(throwable.getMessage());
}
@Override
public void onSubscribe(Disposable arg0) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(Integer value) {
// TODO Auto-generated method stub
System.out.println(value);
}
});
}
示例10: query
import io.reactivex.Observable; //导入方法依赖的package包/类
Observable<List<String>> query(String text) {
List<String> alist = new ArrayList<String>();
alist.add("asdf");
alist.add("qwer");
return Observable.fromArray(alist);
}
示例11: setUp
import io.reactivex.Observable; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
ob = Observable.fromArray(nums);
}
示例12: getBoyNames
import io.reactivex.Observable; //导入方法依赖的package包/类
Observable<String> getBoyNames() {
return Observable.fromArray("Manish", "David", "Rohan", "Gurpreet");
}
示例13: getObservable
import io.reactivex.Observable; //导入方法依赖的package包/类
private Observable<String> getObservable() {
//
return Observable.fromArray("a", "b", "c", "d");
}
示例14: getGirlNames
import io.reactivex.Observable; //导入方法依赖的package包/类
Observable<String> getGirlNames() {
return Observable.fromArray("Monishaa", "Sonakshi", "Aravi", "Stephanie");
}