I am developing a project in android. I have five arrays of type String, with each item in the array related to the respective index of the remaining arrays. Here I need to sort the single array, if I sort, all the respective index should replicate in the proper order as it was present in the sorted array.
Source code:
array1 = new String[qrcodelist.size()];
array2 = new String[name.size()];
array3 = new String[company.size()];
array4 = new String[date.size()];
array5 = new String[imageurl.size()];
for (int i = 0; i < name.size(); i++) {
array1[i] = qrcodelist.get(i);
array2[i] = name.get(i);
array3[i] = company.get(i);
array4[i] = date.get(i);
array5[i] = imageurl.get(i);
}
I thought to implement the same using HashMap
but was not sure on how to do it.
I request you to give me a logic to implement this task or any sample code.