Posted By:
pmoc__2001
Posted On:
Thursday, May 6, 2004 10:45 AM
Hi, After much head scratching and goggling I have hit a brick wall. I have implemented a hashtable (recordHolder) of arrays and I am having problems updating an array pulled from the hash table without overwriting. The order is passed from XML, is numerical and will only ever be 1, 2, and 3 so a 4-element array is used starting at [1] public void addOrder(String orderName, int order, int number ) { //get array using orderName as key int[] orderList = (int[])(recordHolder.get(orderName)); //append array at element order 1,2, or 3 orderList[order] = number; //place back into hashtable recordHolder.put(orderName, orderList);
More>>
Hi,
After much head scratching and goggling I have hit a brick wall.
I have implemented a hashtable (recordHolder) of arrays and I am having problems updating an array pulled from the hash table without overwriting. The order is passed from XML, is numerical and will only ever be 1, 2, and 3 so a 4-element array is used starting at [1]
public void addOrder(String orderName, int order, int number )
{
//get array using orderName as key
int[] orderList = (int[])(recordHolder.get(orderName));
//append array at element order 1,2, or 3
orderList[order] = number;
//place back into hashtable
recordHolder.put(orderName, orderList);
}
When I look at my output my array seems to overwrite itself as if the other arrays associated with each orderName are not being accessed.
Thank you to anyone who can give me some tips.
<<Less