how to make an array of arrays
Posted
by
yuliya
on Stack Overflow
See other posts from Stack Overflow
or by yuliya
Published on 2011-01-16T18:40:56Z
Indexed on
2011/01/16
18:53 UTC
Read the original article
Hit count: 171
hi, how would you write an array of values to other array. In instance, I have a list of IPs and list of requests. I want to have something like [{ip1, request1}, {ip2, request2}, ....].
It's how I would do it, but sure obj will change every time and array will have all the time the same values.
ArrayList array = new ArrayList();
Object[] obj = new Object[2];
for (int i=0; i<listSize; i++){
obj[0] = ipList.get(i).toString();
obj[1] = requestList.get(i);
array.add(obj);
© Stack Overflow or respective owner