creating string arrays through for loop, in java

Haya suleman

I have a long Array, and for every long value i m using this query to fetch a string Array from sqlite database.

long[] mylong= {1,3,5,6,7};
Dbadapter finaldb = new Dbadapter(this);
for(int i=0; i<mylong.length; i++) {
        finaldb.open();
        String[] string_array = finaldb.getArray(mylong[i]);
        finaldb.close();

now, i want to store these different string arrays with some name so that i can use them after. but i don't know how to achieve this. If any one can guide me in the right direction?

CoderCroc

You can have ArrayList<String[]> to store arrays and add those array to list and use get method to retrieve the array or you can use Map<key,value> to manage the key value based structure for retrieval of array.

FOR EXAMPLE

String str[]=new String[10];
str[0]="abc";
//and other values
List<String[]> list=new ArrayList<String[]>();
list.add(str);
//OR
Map<Long,String[]> map=new HashMap<Long,String[]>();
map.put(myLong[0],str);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Creating multiple arrays using one for loop in Java

From Dev

Loop through array and creating new arrays based on object properties

From Dev

How to loop through 2 different arrays in one loop in Java

From Dev

Creating Arrays Dynamically with a for loop

From Dev

Creating a string from loop results in java

From Dev

Find a string in MySQL table through a loop in multiple arrays

From Dev

Loop through arrays manually

From Dev

Loop through XML String using XPath - Java

From Dev

Loop through string - input as parameter [java]

From Dev

Looping through foreach and creating Arrays

From Dev

Make the loop results appear in an array through Arrays.toString in Java

From Dev

Loop through sheets creating graphs

From Dev

Creating a function to loop through Powershell

From Dev

Creating Dataframes through R For Loop

From Dev

for loop creating extra arrays in return

From Dev

Functions and arrays in for loop creating error

From Java

Creating a Set of Arrays in java

From Java

Creating generic arrays in Java

From Dev

Perl loop through hash of arrays

From Dev

How to loop through arrays in reactjs

From Dev

Lodash loop through an array of arrays

From Dev

How to loop through an array of arrays?

From Dev

Loop through nested arrays PHP

From Dev

Loop through dynamically named arrays

From Dev

Arithmetic for loop through arrays of pointers

From Dev

Loop randomly through multiple arrays

From Dev

loop through array of arrays of arrays php

From Java

How to loop through a string ArrayList and create temporary Character Arrays of each word in the String ArrayList

From Dev

For loop through a string

Related Related

HotTag

Archive