title: Do you have a test to show differences between the reactor map() and flatMap()?
body: <p>I am still trying to understand the difference between the reactor map() and flatMap() method.
  First I took a look at the API, but it isn't really helpful, it confused me even more.
  Then I googled a lot, but it seems like nobody has an example to make the differences understandable, if there are any differences.</p>
  <p>Therefore I tried to write two tests to see the different behaviour for each methods.
  But unfortunatley it isn't working as I hoped it would...</p>
  <p>First test method is testing the reactive flatMap() method:</p>
  <pre><code>@Test
  void fluxFlatMapTest() {
      Flux.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
              .window(2)
              .flatMap(fluxOfInts -&gt; fluxOfInts.map(this::processNumber).subscribeOn(Schedulers.parallel()))
              .doOnNext(System.out::println)
              .subscribe();
  }
  </code></pre>
  <p>The output is as expected, explainable and looks like that:</p>
  <pre><code>9 - parallel-2
  1 - parallel-1
  4 - parallel-1
  25 - parallel-3
  36 - parallel-3
  49 - parallel-4
  64 - parallel-4
  81 - parallel-5
  100 - parallel-5
  16 - parallel-2
  </code></pre>
  <p>The second method should test the output of the map() method to compare with above results of the flatMap() method.</p>
  <pre><code>@Test
  void fluxMapTest() {
      final int start = 1;
      final int stop = 100;
      Flux.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
              .window(2)
              .map(fluxOfInts -&gt; fluxOfInts.map(this::processNumber).subscribeOn(Schedulers.parallel()))
              .doOnNext(System.out::println)
              .subscribe();
  }
  </code></pre>
  <p>This test method has the output, I didn't expected at all and looks like that:</p>
  <pre><code>FluxSubscribeOn
  FluxSubscribeOn
  FluxSubscribeOn
  FluxSubscribeOn
  FluxSubscribeOn
  </code></pre>
  <p>There is a little helper method which looks like that:</p>
  <pre><code>private String processNumber(Integer x) {
      String squaredValueAsString = String.valueOf(x * x);
      return squaredValueAsString.concat(&quot; - &quot;).concat(Thread.currentThread().getName());
  }
  </code></pre>
  <p>Nothing special here.</p>
  <p>I am using Spring Boot 2.3.4 with Java 11 and the reactor implementation for Spring.</p>
  <p>Do you have a good explaning example or do you know how to change the above tests so that they make sense?
  Then please help me out with that.
  Thanks a lot in advance!</p>