Close

Reactor - Create Flux Instance From Array

[Last Updated: Sep 27, 2020]

Flux#fromArray() can be used to create an instance that emits the items contained in the provided array.

public static <T> Flux<T> fromArray(T[] array)

Example

package com.logicbig.example;

import reactor.core.publisher.Flux;

public class FluxFromArrayExamples {
  public static void main(String[] args) {
      System.out.println("-- Flux#fromArray example --");
      Integer[] integers = {1, 3, 5};
      Flux.fromArray(integers)
          .subscribe(System.out::println);
  }
}
-- Flux#fromArray example --
1
3
5

Example Project

Dependencies and Technologies Used:

  • reactor-core 3.3.10.RELEASE: Non-Blocking Reactive Foundation for the JVM.
  • JDK 8
  • Maven 3.5.4

Reactor - Flux#fromArray() Example Select All Download
  • reactor-create-instance-from-array
    • src
      • main
        • java
          • com
            • logicbig
              • example
                • FluxFromArrayExamples.java

    See Also