Reputation: 1169
I am trying to create a table like data structure to hold three array lists associated with each other for an Android application. The first array list will hold index values, the second will hold an actual value and the third will be a flag to say whether the actual value has changed or not. Would anyone please be able to help me with any advice or tips to solve this problem? Thank you very much in advance.
Upvotes: 1
Views: 972
Reputation: 2185
public class A{
int index, ArrayList<B> list;
}
public class B{
boolean valueChanged,String actualValue;
}
So in the end use this:
WeakHashMap<String, List<A>> hashMap;
Upvotes: 0
Reputation: 22903
Better use Map
by placing a map into a map. This is a good way to hold 3 data in a row.
Map <Integer, HashMap<String, Boolean>> table =
new HashMap <Integer, HashMap<String, Boolean>>();
The inner Map
contains the values: actual value and flag. The outer Map
contains the index to access the inner map which contains the values.
Upvotes: 1