blob: ab7bbcb7d65c0f83a899c684b144a27b64345e0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package cgeo.geocaching.sorting;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.utils.TextUtils;
import org.apache.commons.lang3.StringUtils;
import java.text.Collator;
/**
* sorts caches by name
*
*/
class NameComparator extends AbstractCacheComparator {
private final Collator collator = TextUtils.getCollator();
@Override
protected boolean canCompare(final Geocache cache) {
return StringUtils.isNotBlank(cache.getName());
}
@Override
protected int compareCaches(final Geocache cache1, final Geocache cache2) {
return collator.compare(cache1.getNameForSorting(), cache2.getNameForSorting());
}
}
|