Get all updates of Java4s
Newsletter

How to sort ArrayList in java, Sorting java Collections

Core Java »on Oct 23, 2012 { 4 Comments } By Sivateja

Let us see how to sort values in java collections, List/ArrayList.  We can achieve this by using Collections class, Collections class contains a method sort(Collection Object), just give your collection object to the sort() method that’s it, consider this example….

SortCollection.java

Output

Countries : Australia
Countries : India
Countries : Lundon
Countries : Malaysia
Countries : United States

You Might Also Like

  ::. About the Author .::

Java4s_Author
- Full Stack Java/J2EE & UI Web Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.

Comments

4 Responses to “How to sort ArrayList in java, Sorting java Collections”
  1. Can You Please Update the Jasper Reporting Tool

  2. kumar says:

    can we please write the code to display arraylist elements in dropdown

    ex
    if click on country it disply the state dropdown

  3. saif says:

    My Question is—— if we remove element from Arraylist index basis.how to find which element is removed from arraylist.mean find removed element

    plz sir……………..

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Spring-Boot-tutorials Hibernate tutorials Spring tutorials Struts tutorials Servlets tutorials Ajax tutorials Log4j tutorials jQuery tutorials Json tutorials Core Java tutorials Web Services tutorials AngularJs tutorials
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2018 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.