S
Sharp
Hi
I have a HashMap.
Each key is mapped to a value (an ArrayList of Character objects).
How easy is it to compare a column of characters in the HashMap?
Maybe there is a better datastructure to use for my purpose?
For example, if the column contains characters that are the same then keep
score.
123 abcfdgdslfkjkdfj
456 acsajdhkjsahdkj
score: 1 (first column contains 'a')
-----------------
Code.java:
-----------------
Map table = new HashMap();
//lets assume table is populated with data
Collection c = table.values();
for (int i=0; i<valueArray.length; i++) //valueArray = ArrayList of
Character objects
{
Iterator itr = c.iterator();
While (itr.hasNext()) // problem can't refer row by index
{
ArrayList characterList = (ArrayList)itr.next();
characterList.get(i)
...
}
I have a HashMap.
Each key is mapped to a value (an ArrayList of Character objects).
How easy is it to compare a column of characters in the HashMap?
Maybe there is a better datastructure to use for my purpose?
For example, if the column contains characters that are the same then keep
score.
123 abcfdgdslfkjkdfj
456 acsajdhkjsahdkj
score: 1 (first column contains 'a')
-----------------
Code.java:
-----------------
Map table = new HashMap();
//lets assume table is populated with data
Collection c = table.values();
for (int i=0; i<valueArray.length; i++) //valueArray = ArrayList of
Character objects
{
Iterator itr = c.iterator();
While (itr.hasNext()) // problem can't refer row by index
{
ArrayList characterList = (ArrayList)itr.next();
characterList.get(i)
...
}