title: bitwise and between Comparator and Serializable in Comparator.comparing
body: <p>I am looking at the source code of the <code>Comparator.comparing</code> method implemented in Java8</p>
  
  <p>here is the code</p>
  
  <pre><code>public static &lt;T, U&gt; Comparator&lt;T&gt; comparing(
          Function&lt;? super T, ? extends U&gt; keyExtractor,
          Comparator&lt;? super U&gt; keyComparator)
  {
      Objects.requireNonNull(keyExtractor);
      Objects.requireNonNull(keyComparator);
      return (Comparator&lt;T&gt; &amp; Serializable)
          (c1, c2) -&gt; keyComparator.compare(keyExtractor.apply(c1),
                                            keyExtractor.apply(c2));
  }
  </code></pre>
  
  <p>Why the bit-wise <code>and</code> between <code>Comparator</code> and <code>Serializable</code> is required and what it does?</p>
  
  <pre><code>(Comparator&lt;T&gt; &amp; Serializable)
  </code></pre>
  
  <p>It can be simply casted to <code>Comparator</code> for chaining.</p>
  
  <p>also how does bit-wise operations works in case of non numeric values?</p>
  
  <p>Thanks.</p>