Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

sorting  RSS feed

 
Shruthi Babu
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to sort an array list based on values in another list.

For ex if arraylist 1 constains { A , B , C, D}

and arraylist two contains { C , D, A, B}

my sorted list output should contain { C , D, A, B}

what is the best way to implement this. for now i just iterate using a for loop and store it in a new list and replace the old list. I know it is not a good approach

any help is higly appreciated.

-Rohini
 
Anand Hariharan
Rancher
Posts: 272
C++ Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at David's reply in this thread here
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!