blaise
blaise

Reputation: 11

Java Collator sorting

I'm using java Collator . I've created Collator with bubble sort.

public static void sortStrings(Collator collator, String[] words) {
    String tmp;

for (int i = 0; i < words.length; i++) {
    for (int j = i + 1; j < words.length; j++) {
        if (collator.compare(words[i], words[j]) > 0) {
            tmp = words[i];
            words[i] = words[j];
            words[j] = tmp;
        }
    }
}


}

Now I'm trying to create collator with Arrays.sort() with Comparator and Lambda ( 2 other functions). Do you have any suggestions , tips , guids , sollutions according for this problem ?

Upvotes: 0

Views: 263

Answers (0)

Related Questions