title: Comparator cannot be resolved to a type, what should i do
body: <p>i want to use built in compare function to sort Strings according to specific method, but there was an error occurred. what should i use Comparator</p>
  
  <p>VsCode
  openjdk version "1.8.0_191-1-redhat"
  OpenJDK Runtime Environment (build 1.8.0_191-1-redhat-b12)
  OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)</p>
  
  <pre><code>public String[] reorderLogFiles(String[] logs){
  
      Comparator&lt;String&gt; myComp = new Comparator&lt;String&gt;(){
          //@Override
          public int compare(String s1, String s2){
              int s1si = s1.indexOf(' ');
              int s2si = s2.indexOf(' ');
              char s1fc = s1.charAt(s1si+1);
              char s2fc = s2.charAt(s2si+1);
              if(s1fc&lt;='9'){
                  if(s2fc&lt;='9')return 0;
                  else return 1;
              }
              if(s2fc&lt;='9')return -1;
  
              int isNeedChange = s1.substring(s1si+1).compareTo(s2.substring(s2si+1));
              if(isNeedChange == 0)return s1.substring(0,s1si).compareTo(s2.substring(0,s2si));
              return isNeedChange;
          }
      };
  
      Arrays.sort(logs,myComp);
      return logs;
  }
  </code></pre>
  
  <p>Comparator cannot be resolved to a type</p>