title: When to use a diamond operator with a method call in Java in form of .<ClassName>methodName()?
body: <p>Sometimes I see examples of using a diamond operator in the method invocation.</p>
  <p>An example of syntax is:</p>
  <pre><code>.&lt;ClassName&gt;methodName()
  </code></pre>
  <p>I'm not sure that I understand entirely in which condition there is a case for such use.
  Didn't find an explanation of that in the references.</p>
  <p>May you explain that case or suggest a source of information where I can find an explanation?</p>
  <p>I am providing working an example down below. This example uses RxJava2.
  There <code>Flowable.&lt;Integer&gt;create(emitter -&gt; emit(emitter), BackpressureStrategy.BUFFER)</code> doesn't compile without <code>&lt;Integer&gt;</code> because the method emit accepts <code>FlowableEmitter&lt;Integer&gt; emitter</code>.</p>
  <pre><code>
  import io.reactivex.BackpressureStrategy;
  import io.reactivex.Flowable;
  import io.reactivex.FlowableEmitter;
  import io.reactivex.schedulers.Schedulers;
  
  public class Sample {
  
      public static void main(String[] args) {
          Flowable.&lt;Integer&gt;create(emitter -&gt; emit(emitter), BackpressureStrategy.BUFFER)
                  .observeOn(Schedulers.computation(), true,2)
                  .map(data -&gt; data * 1)
                  .subscribe(Sample::process,
                          err -&gt; System.out.println(&quot;ERROR: &quot; + err),
                          () -&gt; System.out.println(&quot;DONE&quot;));
  
      }
  
      public static void process(int value) {
          System.out.println(value);
          sleep(1000);
      }
  
      private static void emit(FlowableEmitter&lt;Integer&gt; emitter) {
          int count = 0;
  
          while(count &lt; 10) {
              count++;
  
              System.out.println(&quot;Emitting ...&quot; + count);
              emitter.onNext(count);
              sleep(500);
          }
      }
  
      private static boolean sleep(int ms) {
          try {
              Thread.sleep(ms);
              return true;
          } catch (InterruptedException e) {
              return false;
          }
      }
  
  
  }
  </code></pre>
  <p>When I try to simulate a similar case with plain Java it doesn't work. What I understand wrong?</p>
  <pre><code>
  public class Sample2 {
  
      public static void main(String[] args) {
          GenericClass.&lt;Integer&gt;genericMethod(param -&gt; processParam(param));
  
      }
  
      private static void processParam(GenericClass&lt;Integer&gt; b) {
          }
      }
  
  }
  
  class GenericClass &lt;T&gt; {
      public static &lt;T&gt; GenericClass&lt;T&gt; genericMethod(GenericInterface&lt;T&gt; genericinterface) {
          return new GenericClass&lt;T&gt;();
      }
  }
  
  interface GenericInterface &lt;T&gt; {
      T doJob();
  }
  
  </code></pre>