Java Path Create nio createPathComparator()

Here you can find the source of createPathComparator()

Description

create Path Comparator

License

Open Source License

Declaration

private static Comparator<Path> createPathComparator() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.file.Path;

import java.util.Comparator;

public class Main {
    private static Comparator<Path> createPathComparator() {
        return new Comparator<Path>() {
            @Override/*w ww .j a  va  2s  .co m*/
            public int compare(Path p1, Path p2) {
                String s1 = (p1 != null ? p1.toString() : null);
                String s2 = (p2 != null ? p2.toString() : null);
                if (s1 == null) {
                    s1 = "";
                }
                return s1.compareTo(s2 != null ? s2 : "");
            }
        };
    }
}

Related

  1. createLanguageStructure(final String lang, final Path docRootFolder)
  2. createList(Iterable dirs)
  3. createMainClassAndBuildFileWithDeps(String targetName, String deps, Path dir)
  4. createOverwriteDirectory(Path path)
  5. createPath(String fileName, String subfolder)
  6. createPathMatcher(String[] patterns)
  7. createPathOrNull(String pathString)
  8. createPathRelativizer(Path path, boolean doRelativize)
  9. createProperties(final Path directory, final Properties properties)