org.snapscript.parse.LengthComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.parse;
import java.util.Comparator;
public class LengthComparator implements Comparator{
public LengthComparator() {
super();
}
@Override
public int compare(String left, String right) {
int leftLength = left.length();
int rightLength = right.length();
if(leftLength < rightLength) {
return 1;
}
if(leftLength == rightLength) {
return 0;
}
return -1;
}
}