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;

    public NameComparator() {
        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());
    }
}

@@ -297,57 +297,8 @@
 tor 
-collator;%0A%0A    public NameComparator() %7B%0A        
 coll
@@ -328,22 +328,16 @@
 lator();
-%0A    %7D
 %0A%0A    @O

Initialize final field in field declaration