Forums Register Login

RunTime Dynamic String Array split?

+Pie Number of slices to send: Send
Hi,

I have String array like

String arr[] = {"one","two","three","four","five","six","seven","eight"};

e.g
I have done like this.

List testData = new ArrayList();
Map map1 = new TreeMap();
Map map2 = new TreeMap();

map1.put("1",arr[0]);
map1.put("2",arr[1]);
map1.put("3",arr[2]);
map1.put("4",arr[3]);
testData.add(audit1);

map2.put("1",arr[4]);
map2.put("2",arr[5]);
map2.put("3",arr[6]);
map2.put("4",arr[7]);
tes2Data.add(audit2);

IS OTHER ANY GOOD WAY TO PUT DIFFERENT MAP,ARRAY LIST IN RUN TIME?
Thanks
+Pie Number of slices to send: Send
what are audit1, audit2 here ? i don't understand your question. What is the criteria for splitting?
+Pie Number of slices to send: Send
Perhaps this is better suited to Java in General (Beginner).
+Pie Number of slices to send: Send
Hi,

I have String array like

String arr[] = {"one","two","three","four","five","six","seven","eight"};

e.g
I have done like this.

List testData = new ArrayList();
Map map1 = new TreeMap();
Map map2 = new TreeMap();

map1.put("1",arr[0]);
map1.put("2",arr[1]);
map1.put("3",arr[2]);
map1.put("4",arr[3]);
testData.add(map1);

map2.put("1",arr[4]);
map2.put("2",arr[5]);
map2.put("3",arr[6]);
map2.put("4",arr[7]);
tes2Data.add(map2);

IS OTHER ANY GOOD WAY TO PUT DIFFERENT MAP,ARRAY LIST IN RUN TIME?
Thanks
+Pie Number of slices to send: Send
Here is another way.



Your example is not really real world because you dont always know know the size of your array and you would be loading your maps on the values in your array instead of just position.
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1164 times.
Similar Threads
Q on TreeMap
nested treemap
how to search equalignorecase search with hashmap
criteria string
Problem regarding HashMap.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:49:31.