views:

62

answers:

1

I have a List of string array already populated in storeInv. How do i change a specific element in the string array? For example the code below...

Thanks =]

List <String[]> storeInv ;  //assume already populated with elements
String[] store = storeInv.get(5);
store[1] = 123;

store.set(5, store[1]);  //this gives me an error.
+4  A: 
List <String[]> storeInv = ...
String[] store = storeInv.get(5);

// This updates an element in one of the arrays.  (You cannot
// assign an integer literal to a String or a String array element.)
store[1] = "123";

// This updates an array in the list ... but in this
// case it is redundant because the 5th list element
// is already the same object as 'store'.
store.set(5, store);
Stephen C
ic, thanks =]]]
nubme