title: Java: How to search duplicate files in a folder not only by name ,but also by size and content?
body: <p>I want to create a Java application to identify duplicates. So far I can find duplicates only by name, but I also need size, file type, and maybe content. This is my code so far, using a <code>HashMap</code>:</p>
  
  <pre class="lang-java prettyprint-override"><code>public static void find(Map&lt;String, List&lt;String&gt;&gt; lists, File dir) {
      for (File f : dir.listFiles()) {
          if (f.isDirectory()) {
              find(lists, f);
          } else {
              String hash = f.getName() + f.length();
              List&lt;String&gt; list = lists.get(hash);
              if (list == null) {
                  list = new LinkedList&lt;String&gt;();
                  lists.put(hash, list);
              }
              list.add(f.getAbsolutePath());
          }
      }
  }
  </code></pre>