Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7563163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:35:42+00:00 2026-05-30T13:35:42+00:00

I am developing an android application where i have data in Norwegian language. Now

  • 0

I am developing an android application where i have data in Norwegian language. Now , i have to sort a list of name alphabetically where the names contain special norwegian characters.

    Comparator<SetGetMethods> comperator = new Comparator<SetGetMethods>() {

        public int compare(SetGetMethods object1, SetGetMethods object2) {

                return object1.getCityname().compareToIgnoreCase(object2.getCityname());

        }

    };
    Collections.sort(temp, comperator);

I used the code above to sort the list alphabetically. But after sorting , the names with normal characters shown on top and names with special norwegian characters shown below them. For example , the list is shown like below ,

Arendal
Bergen
Drammen
Ålesund -> ( This should be on top , before Arendal after sorting )

So , my question is , how can i sort a list alphabetically where the list data contains special characters(Norwegian characters). I will appreciate any suggestion , idea or sample code to solve the problem. Thanks …..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:35:44+00:00Added an answer on May 30, 2026 at 1:35 pm

    Take a look at the example based on Norwegian in the JavaDoc for the RuleBasedCollator class.

    Based on that, I’ve created this example that puts Å before A based on a accent difference — note the use of ‘;’ to put \u00E5 before A. So this works for your example input, but you’ll need to add other accented Norwegian characters based on your knowledge of the language to complete the norwegian comparison string.

    String norwegian = "< a, \u00E5;A< b,B< c,C< d,D< e,E< f,F< g,G< h,H< i,I< j,J" +
                       "< k,K< l,L< m,M< n,N< o,O< p,P< q,Q< r,R< s,S< t,T" +
                       "< u,U< v,V< w,W< x,X< y,Y< z,Z";                      
    RuleBasedCollator myNorwegian = new RuleBasedCollator(norwegian);     
    List<String> words = 
      Arrays.asList("Arendal Bergen Drammen \u00E5lesund".split("\\s"));     
    System.out.println(words);     
    Collections.sort(words, myNorwegian);     
    System.out.println(words);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are developing an application in android,We have to save some lists and data
Background I am developing an application for android in eclipse and now I have
I am developing an android game application,I have implemented all the screens.Now i want
I am developing an android application in which i have data coming from Url,The
I am developing an android application in which i have to show data from
I am developing an android application in which i have to show large data
Hi i am developing android application, And now i have to use sqlite database
i am developing an android todo list app to learn. right now in my
I am developing an android application that receives data about events from a server.
Developing an application for Android, i want to record data that will be usefull

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.