public class PathComparator extends Object implements Comparator<String>
Sort lexicographically by directory structure, then filename.
For example:2 - /a/foo2.txt 1 - /a/foo1.txt 3 - /a/b/foo.txt 2 - /a/foo2.txt 1 - /a/foo1.txt 3 - /a/b/foo.txt
Constructor and Description |
---|
PathComparator() |
Modifier and Type | Method and Description |
---|---|
protected int |
compare(int index,
String[] tokens1,
String[] tokens2) |
protected int |
compare(String[] tokens1,
String[] tokens2)
Iterate over the tokens from both locations
|
int |
compare(String path1,
String path2) |
protected String[] |
getPathTokens(String s)
Replace backslashes (if there are any) with forward slashes and split the string by forward slash
|
protected boolean |
isLastToken(int index,
String[] tokens) |
protected void |
validateCompareArguments(int index,
String[] tokens1,
String[] tokens2) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public PathComparator()
public int compare(String path1, String path2)
compare
in interface Comparator<String>
protected int compare(String[] tokens1, String[] tokens2)
protected void validateCompareArguments(int index, String[] tokens1, String[] tokens2) throws IllegalArgumentException
IllegalArgumentException
protected String[] getPathTokens(String s)
protected boolean isLastToken(int index, String[] tokens)
Copyright © 2010–2014 The Kuali Foundation. All rights reserved.