I am working on an application that saves information about restaurants, each restaurant has 5 info " as listed in the code below ", I need to sort the restaurants according to the rate. However, after I sort according to rate I need to synchronize all the array lists together so that their information fits correctly.
I have 5 ArrayLists, I need to sort one of them, but I also want to change the indexes of the 4 other ArrayLists so they can fit with each other. I tried the Map list but it tells me that i can do it with only 2 parameters and not 5.
Here is my ArrayLists :
//******* Arrays that holds information of restaurants taken from SERVER
static public ArrayList<String> name = new ArrayList<String>();
static public ArrayList<String> lng = new ArrayList<String>();
static public ArrayList<String> lat = new ArrayList<String>();
static public ArrayList<String> address = new ArrayList<String>();
static public ArrayList<String> rate = new ArrayList<String>();
static public ArrayList<String> comment = new ArrayList<String>();
//private Map<String, String> sorted = new HashMap<>(); Doesn't work with 5 parameters
I need to sort the rate List, but also change the indexes of the others.
Listof your model object, sort the list.Collections.sortand override yourComparator.