All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.xenit.apix.configuration.ConfigurationFileComparator Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
package eu.xenit.apix.configuration;

import eu.xenit.apix.filefolder.NodePath;

import java.util.Comparator;

public class ConfigurationFileComparator implements Comparator {

    private String buildString(ConfigurationFile toString) {
        //The reason multiple different spaces are returned is: being more deterministic.
        if (toString == null) {
            return "";
        }
        NodePath path = toString.getPath();
        if (path == null) {
            return " ";
        }
        String displayPath = path.getDisplayPath();
        if (displayPath == null) {
            return "  ";
        }
        return displayPath;
    }

    @Override
    public int compare(ConfigurationFile first, ConfigurationFile second) {
        return buildString(first).compareTo(buildString(second));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy