I am writing a program with Java, which is merging all pictures of several folders into only one folder. The program itself is working very good, but now, I want to check before merging a picture into the "overallfolder", if it is already in the folder. For example if the picture was in two or more folders in the same time, so I will not have duplicates in it.
It doesn't matter if the file name is the same, I want to prove if the picture itself is the same.
The following function in my program lists all files and folders in one folder:
private void listSubFolders(String path) {
    //System.out.println("Controll Folder: "+path); //DEBUG
    ArrayList<String> localPicturePaths = new ArrayList<String>();
    File[] files = new File(path).listFiles();
    if(files != null) {
        for(File file : files) {
            if(file.isDirectory()) {
                //System.out.println("Folder: "+file.getName()); //DEBUG
                listSubFolders(file.getAbsolutePath());
            } else if(file.isFile()) {
                if(containsIgnoreCase(getFileExtension(file), fileTypes)) {
                    //System.out.println("File: "+file.getName()+" in Folder "+file.getParent()); //DEBUG
                    localPicturePaths.add(file.getAbsolutePath());
                } else {
                    //System.out.println("Ignore File: "+file.getName()); //DEBUG
                }
            }
        }
    }
So, there is a function to go over all pictures who are already in the folder. What I need is a good working function to check for the next picture, if it's already is in the list of moved pictures. I am especially searching for an efficient way which isn't making the program hours of time slower.
Do you have any ideas?
