Reactor系列(十四)buffer缓冲
Posted javaweibiancheng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Reactor系列(十四)buffer缓冲相关的知识,希望对你有一定的参考价值。
#java#reactor#flux#buffer#
缓冲
视频讲解: https://www.bilibili.com/video/av81107026/
FluxMonoTestCase.java
package com.example.reactor; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import java.util.List; @Slf4j public class FluxMonoTestCase extends BaseTestCase { @Test public void buffer(){ Flux<String> stringFlux = Flux.just("a","b","c","d","e","f","g"); stringFlux.subscribe(x -> System.out.print("->"+x)); System.out.println(); Flux<List<String>> listFlux = stringFlux.buffer(2); listFlux.subscribe(x -> System.out.print("->"+x)); } }
结果:
->a->b->c->d->e->f->g
->[a, b]->[c, d]->[e, f]->[g]
关注公众号,坚持每天3分钟视频学习
以上是关于Reactor系列(十四)buffer缓冲的主要内容,如果未能解决你的问题,请参考以下文章