I became recently aware, that Java Collation seems to ignore spaces.
I have a list of the following terms:
Amman Jost
Ammann Heinrich
Ammanner Josef
Bär Walter
Bare Werner
Barr Burt
Barraud Maurice
The order above reflects the desired ordering for Germany, i.e. taking space into acount. However, Java Collation using
Collator collator = Collator.getInstance(Locale.GERMANY);
Collections.sort(values, collator);
gives me the following order:
Amman Jost
Ammanner Josef
Ammann Heinrich
Bare Werner
Barraud Maurice
Barr Burt
Bär Walter
The result above is actually not what I have expected, since spaces are not taken into account (looks like the case described here: Wikipedia Alphabetical order).
Does this mean, that Java Collation is not usable for such use case or am I doing something wrong here? Is there a way to make Java Collation space aware?
I would be glad for any comments or recommendations.