title: Why don't implement all method in interface Comparator?
body: <p>Today, I'm trying to learn some features in Java 8, specific about Lambda Expressions. I create a new Comaparator like this :</p>
  
  <pre><code>Comparator&lt;String&gt; strCom = new Comparator&lt;String&gt;() {
      @Override
      public int compare(String o1, String o2) {
          return 0;
      }
  };
  </code></pre>
  
  <p>When I read code inside Comparator interface, I have got confused. Althrough interface Comparator have two method <em>compare()</em> and <em>equals()</em>, we don't need implement all of them. I had found some reason why we don't need implement method <em>equals()</em> <a href="https://stackoverflow.com/a/11758069/2865414">here</a>. But i also read in javadocs </p>
  
  <blockquote>
    <p><em>If your class claims to implement an interface, all methods defined by that interface must appear in its source code before the class will successfully compile</em>. <strong><a href="https://docs.oracle.com/javase/tutorial/java/concepts/interface.html" rel="nofollow noreferrer">What Is an Interface?</a></strong> </p>
  </blockquote>
  
  <p><strong>So, can someone help me understand this ? Do not override <em>equals()</em> is still legal ?</strong></p>