I have to fetch all duplicate images from device (from internal and external storage both) and list them into group wise and delete as per choice. I need to implement functionality like this app Click to see
I tried this method:
  public static List<String> findDuplicatesForDeletion(String directoryPath) {
    List<Map<String, Integer>> pairs = findDuplicateImagePairs(directoryPath);
    List<String> output = new ArrayList();
    boolean isFirstElementInPair = true;
    if(null != pairs && !pairs.isEmpty()) {
        Iterator i$ = pairs.iterator();
        while(true) {
            Map pair;
            do {
                do {
                    if(!i$.hasNext()) {
                        return output;
                    }
                    pair = (Map)i$.next();
                } while(pair.isEmpty());
            } while(pair.keySet().size() <= 1);
            List<Entry<String, Integer>> pairEntryList = new ArrayList(pair.entrySet());
            Collections.sort(pairEntryList, new Comparator<Entry<String, Integer>>() {
                public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
                    return ((Integer)o2.getValue()).compareTo((Integer)o1.getValue());
                }
            });
            isFirstElementInPair = true;
            Iterator i$ = pairEntryList.iterator();
            while(i$.hasNext()) {
                Entry<String, Integer> entry = (Entry)i$.next();
                if(isFirstElementInPair) {
                    isFirstElementInPair = false;
                } else {
                    output.add(entry.getKey());
                }
            }
        }
    } else {
        return null;
    }
}
