java - Android How do I order an array based on integers from another array -


Actually, I have two arrays that are filled with values ​​of the same number (although the number of values ​​in the same array remains the same

  • Dean

  • Jane
  • Steve
  • 2
  • 1
  • 4
  • I've used the array list as below: ArrayList namelist = new ArrayList () ;

    Sort the list with just names You can use Collections.sort () because the string is comparative. Then the string in the order of the index Create new list.

      List & lt; string & gt; NewList = new arreelist & lt; & gt; (); // or new arreelist & lt; string & gt; (); 1.7 collection for source level for name (name list); for (intex idx: indexList) {newList.add (nameslist.get (idx - 1)); }  

    Comments