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

  • SEARCH
  • Home
  • 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 8776775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:08:03+00:00 2026-06-13T19:08:03+00:00

I am studying Java and sorting. I have a question about tracking the index

  • 0

I am studying Java and sorting.

I have a question about tracking the index number for duplicate values.

For example, we have table and I put all data into the ArrayList, like this:

ArrayList = {FOO , AA, BOB, AA, BOB}

Index | Value
1     |  FOO
2     |  AA
3     |  BOB
4     |  AA
5     |  BOB

Now I would like to sort the data:

Index | Value
2     | AA
4     | AA
3     | BOB
5     | BOB
1     | FOO

Is there any way to keep unique index and sort data?

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-06-13T19:08:04+00:00Added an answer on June 13, 2026 at 7:08 pm

    Create a class

    class DataHelper{
      private String name;
      private int index;
      // other stuff
    }
    

    and create List<DataHelper> and write a Comparator to sort DataHelpers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am studying JAVA and I have a question about Sorting string. In the
I am studying Java concurrency right now. I have a question about synchronized and
I'm studying for Java Programmer Certification (SCJP) exam. A question about exceptions, when handle
First of all, i have been studying Java for only the last couple of
I was studying about polymorphism. I couldn't determine the analogy in Java about these
Total noobie question here. I'm just learning Java, and studying passing arguments to functions.
I am learning java, and studying the following example from sun.com. import java.io.*; import
Possible Duplicate: Instantiating a generic class in Java I am studying Generics Java because
I'm a .net developer and I am studying Swing for Java and I have
Studying Java, I've thought about a, to me, rather confusing property of many tutorials.

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.