本文整理匯總了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");
}