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

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

Initialize final field in field declaration
Initialize final field in field declaration
