当前位置: 首页>>代码示例>>Java>>正文


Java Movie类代码示例

本文整理汇总了Java中rx.CovarianceTest.Movie的典型用法代码示例。如果您正苦于以下问题:Java Movie类的具体用法?Java Movie怎么用?Java Movie使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Movie类属于rx.CovarianceTest包,在下文中一共展示了Movie类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reduceWithObjects

import rx.CovarianceTest.Movie; //导入依赖的package包/类
@SuppressWarnings("unused")
@Test
public void reduceWithObjects() {
    Observable<Movie> horrorMovies = Observable.<Movie> just(new HorrorMovie());

    BiFunction<Movie, Movie, Movie> chooseSecondMovie =
            new BiFunction<Movie, Movie, Movie>() {
                @Override
                public Movie call(Movie t1, Movie t2) {
                    return t2;
                }
            };

    Observable<Movie> reduceResult = horrorMovies.scan(chooseSecondMovie).takeLast(1);

    Observable<Movie> reduceResult2 = horrorMovies.reduce(chooseSecondMovie);
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:18,代码来源:ReduceTests.java

示例2: reduceWithCovariantObjects

import rx.CovarianceTest.Movie; //导入依赖的package包/类
/**
 * Reduce consumes and produces T so can't do covariance.
 * 
 * https://github.com/ReactiveX/RxJava/issues/360#issuecomment-24203016
 */
@SuppressWarnings("unused")
@Test
public void reduceWithCovariantObjects() {
    Observable<Movie> horrorMovies = Observable.<Movie> just(new HorrorMovie());

    BiFunction<Movie, Movie, Movie> chooseSecondMovie =
            new BiFunction<Movie, Movie, Movie>() {
                @Override
                public Movie call(Movie t1, Movie t2) {
                    return t2;
                }
            };

    Observable<Movie> reduceResult2 = horrorMovies.reduce(chooseSecondMovie);
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:21,代码来源:ReduceTests.java

示例3: testMergeCovariance4

import rx.CovarianceTest.Movie; //导入依赖的package包/类
@Test
public void testMergeCovariance4() {

    Observable<Movie> o1 = Observable.create(o -> {
        AbstractSubscription.setEmptyOn(o);
        o.onNext(new HorrorMovie());
        o.onNext(new Movie());
        //                o.onNext(new Media()); // correctly doesn't compile
        o.onComplete();
    });

    Observable<Media> o2 = Observable.just(new Media(), new HorrorMovie());

    List<Media> values = Observable.merge(o1, o2).toList().toBlocking().single();

    assertTrue(values.get(0) instanceof HorrorMovie);
    assertTrue(values.get(1) instanceof Movie);
    assertTrue(values.get(2) != null);
    assertTrue(values.get(3) instanceof HorrorMovie);
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:21,代码来源:MergeTests.java

示例4: testConcatCovariance

import rx.CovarianceTest.Movie; //导入依赖的package包/类
@Test
public void testConcatCovariance() {
	HorrorMovie horrorMovie1 = new HorrorMovie();
	Movie movie = new Movie();
	Media media = new Media();
	HorrorMovie horrorMovie2 = new HorrorMovie();
	
    Observable<Media> o1 = Observable.<Media> just(horrorMovie1, movie);
    Observable<Media> o2 = Observable.just(media, horrorMovie2);

    Observable<Observable<Media>> os = Observable.just(o1, o2);

    List<Media> values = Observable.concat(os).toList().toBlocking().single();
    
    assertEquals(horrorMovie1, values.get(0));
    assertEquals(movie, values.get(1));
    assertEquals(media, values.get(2));
    assertEquals(horrorMovie2, values.get(3));
    assertEquals(4, values.size());
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:21,代码来源:ConcatTests.java

示例5: testConcatCovariance2

import rx.CovarianceTest.Movie; //导入依赖的package包/类
@Test
public void testConcatCovariance2() {
	HorrorMovie horrorMovie1 = new HorrorMovie();
	Movie movie = new Movie();
	Media media1 = new Media();
	Media media2 = new Media();
	HorrorMovie horrorMovie2 = new HorrorMovie();
	
    Observable<Media> o1 = Observable.just(horrorMovie1, movie, media1);
    Observable<Media> o2 = Observable.just(media2, horrorMovie2);

    Observable<Observable<Media>> os = Observable.just(o1, o2);

    List<Media> values = Observable.concat(os).toList().toBlocking().single();

    assertEquals(horrorMovie1, values.get(0));
    assertEquals(movie, values.get(1));
    assertEquals(media1, values.get(2));
    assertEquals(media2, values.get(3));
    assertEquals(horrorMovie2, values.get(4));
    assertEquals(5, values.size());
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:23,代码来源:ConcatTests.java

示例6: testConcatCovariance3

import rx.CovarianceTest.Movie; //导入依赖的package包/类
@Test
public void testConcatCovariance3() {
	HorrorMovie horrorMovie1 = new HorrorMovie();
	Movie movie = new Movie();
	Media media = new Media();
	HorrorMovie horrorMovie2 = new HorrorMovie();
	
    Observable<Movie> o1 = Observable.just(horrorMovie1, movie);
    Observable<Media> o2 = Observable.just(media, horrorMovie2);

    List<Media> values = Observable.concat(o1, o2).toList().toBlocking().single();

    assertEquals(horrorMovie1, values.get(0));
    assertEquals(movie, values.get(1));
    assertEquals(media, values.get(2));
    assertEquals(horrorMovie2, values.get(3));
    assertEquals(4, values.size());
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:19,代码来源:ConcatTests.java

示例7: reduceWithObjects

import rx.CovarianceTest.Movie; //导入依赖的package包/类
@SuppressWarnings("unused")
@Test
public void reduceWithObjects() {
    Observable<Movie> horrorMovies = Observable.<Movie> from(new HorrorMovie());

    Func2<Movie, Movie, Movie> chooseSecondMovie =
            new Func2<Movie, Movie, Movie>() {
                public Movie call(Movie t1, Movie t2) {
                    return t2;
                }
            };

    Observable<Movie> reduceResult = horrorMovies.scan(chooseSecondMovie).takeLast(1);

    Observable<Movie> reduceResult2 = horrorMovies.reduce(chooseSecondMovie);
}
 
开发者ID:houdejun214,项目名称:lakeside-java,代码行数:17,代码来源:ReduceTests.java

示例8: testMergeCovariance4

import rx.CovarianceTest.Movie; //导入依赖的package包/类
@Test
public void testMergeCovariance4() {

    Observable<Movie> o1 = Observable.create(new OnSubscribeFunc<Movie>() {

        @Override
        public Subscription onSubscribe(Observer<? super Movie> o) {
            o.onNext(new HorrorMovie());
            o.onNext(new Movie());
            //                o.onNext(new Media()); // correctly doesn't compile
            o.onCompleted();
            return Subscriptions.empty();
        }
    });

    Observable<Media> o2 = Observable.from(new Media(), new HorrorMovie());

    List<Media> values = Observable.merge(o1, o2).toList().toBlockingObservable().single();

    assertTrue(values.get(0) instanceof HorrorMovie);
    assertTrue(values.get(1) instanceof Movie);
    assertTrue(values.get(2) instanceof Media);
    assertTrue(values.get(3) instanceof HorrorMovie);
}
 
开发者ID:houdejun214,项目名称:lakeside-java,代码行数:25,代码来源:MergeTests.java

示例9: testConcatCovariance4

import rx.CovarianceTest.Movie; //导入依赖的package包/类
@Test
public void testConcatCovariance4() {

    Observable<Movie> o1 = Observable.create(new OnSubscribeFunc<Movie>() {

        @Override
        public Subscription onSubscribe(Observer<? super Movie> o) {
            o.onNext(new HorrorMovie());
            o.onNext(new Movie());
            //                o.onNext(new Media()); // correctly doesn't compile
            o.onCompleted();
            return Subscriptions.empty();
        }
    });

    Observable<Media> o2 = Observable.from(new Media(), new HorrorMovie());

    List<Media> values = Observable.concat(o1, o2).toList().toBlockingObservable().single();

    assertTrue(values.get(0) instanceof HorrorMovie);
    assertTrue(values.get(1) instanceof Movie);
    assertTrue(values.get(2) instanceof Media);
    assertTrue(values.get(3) instanceof HorrorMovie);
}
 
开发者ID:houdejun214,项目名称:lakeside-java,代码行数:25,代码来源:ConcatTests.java

示例10: testCovarianceOfZip

import rx.CovarianceTest.Movie; //导入依赖的package包/类
/**
 * This won't compile if super/extends isn't done correctly on generics
 */
@Test
public void testCovarianceOfZip() {
    Observable<HorrorMovie> horrors = Observable.just(new HorrorMovie());
    Observable<CoolRating> ratings = Observable.just(new CoolRating());

    Observable.<Movie, CoolRating, Result> zip(horrors, ratings, combine).toBlocking().forEach(action);
    Observable.<Movie, CoolRating, Result> zip(horrors, ratings, combine).toBlocking().forEach(action);
    Observable.<Media, Rating, ExtendedResult> zip(horrors, ratings, combine).toBlocking().forEach(extendedAction);
    Observable.<Media, Rating, Result> zip(horrors, ratings, combine).toBlocking().forEach(action);
    Observable.<Media, Rating, ExtendedResult> zip(horrors, ratings, combine).toBlocking().forEach(action);

    Observable.<Movie, CoolRating, Result> zip(horrors, ratings, combine);
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:17,代码来源:ZipTests.java

示例11: reduceCovariance

import rx.CovarianceTest.Movie; //导入依赖的package包/类
/**
 * Reduce consumes and produces T so can't do covariance.
 * 
 * https://github.com/ReactiveX/RxJava/issues/360#issuecomment-24203016
 */
@Test
public void reduceCovariance() {
    // must type it to <Movie>
    Observable<Movie> horrorMovies = Observable.<Movie> just(new HorrorMovie());
    libraryFunctionActingOnMovieObservables(horrorMovies);
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:12,代码来源:ReduceTests.java

示例12: libraryFunctionActingOnMovieObservables

import rx.CovarianceTest.Movie; //导入依赖的package包/类
public void libraryFunctionActingOnMovieObservables(Observable<Movie> obs) {
    BiFunction<Movie, Movie, Movie> chooseSecondMovie =
            new BiFunction<Movie, Movie, Movie>() {
                @Override
                public Movie call(Movie t1, Movie t2) {
                    return t2;
                }
            };

    obs.reduce(chooseSecondMovie);
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:12,代码来源:ReduceTests.java

示例13: testCovarianceOfCombineLatest

import rx.CovarianceTest.Movie; //导入依赖的package包/类
/**
 * This won't compile if super/extends isn't done correctly on generics
 */
@Test
public void testCovarianceOfCombineLatest() {
    Observable<HorrorMovie> horrors = Observable.just(new HorrorMovie());
    Observable<CoolRating> ratings = Observable.just(new CoolRating());

    Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).toBlocking().forEach(action);
    Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).toBlocking().forEach(action);
    Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).toBlocking().forEach(extendedAction);
    Observable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).toBlocking().forEach(action);
    Observable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).toBlocking().forEach(action);

    Observable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:17,代码来源:CombineLatestTests.java

示例14: testMergeCovariance

import rx.CovarianceTest.Movie; //导入依赖的package包/类
@Test
public void testMergeCovariance() {
    Observable<Media> o1 = Observable.<Media> just(new HorrorMovie(), new Movie());
    Observable<Media> o2 = Observable.just(new Media(), new HorrorMovie());

    Observable<Observable<Media>> os = Observable.just(o1, o2);

    List<Media> values = Observable.merge(os).toList().toBlocking().single();
    
    assertEquals(4, values.size());
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:12,代码来源:MergeTests.java

示例15: testMergeCovariance2

import rx.CovarianceTest.Movie; //导入依赖的package包/类
@Test
public void testMergeCovariance2() {
    Observable<Media> o1 = Observable.just(new HorrorMovie(), new Movie(), new Media());
    Observable<Media> o2 = Observable.just(new Media(), new HorrorMovie());

    Observable<Observable<Media>> os = Observable.just(o1, o2);

    List<Media> values = Observable.merge(os).toList().toBlocking().single();

    assertEquals(5, values.size());
}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:12,代码来源:MergeTests.java


注:本文中的rx.CovarianceTest.Movie类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。