I built the following object:
public class TableHelper {
private String TABLE;
private String[] COLUMNS;
public TableHelper (String name, String[] columns){
this.TABLE = name;
this.COLUMNS = columns;
}
// GETTERS
public String name(){
return TABLE;
}
public String[] columns(){
return COLUMNS;
}
// SETTERS
public void name(String name){
this.TABLE = name;
}
public void columns(String[] columns){
this.COLUMNS = columns;
}
}
And I'm popping array
with a set of objectos
equal to the top as follows:
public static List<TableHelper> tableList = Arrays.asList(
new TableHelper("menu", new String[]{
"id PRIMARY KEY AUTOINCREMENT",
"position INTEGER",
"active INTEGER"
}),
new TableHelper("menu_languages", new String[]{
"id PRIMARY KEY AUTOINCREMENT",
"menu_id INTEGER",
"language TEXT",
"title TEXT",
}),
new TableHelper("submenu", new String[]{
"id PRIMARY KEY AUTOINCREMENT",
"menu_id INTEGER",
"position INTEGER",
"active INTEGER"
}),
new TableHelper("submenu_languages", new String[]{
"id PRIMARY KEY AUTOINCREMENT",
"submenu_id INTEGER",
"language TEXT",
"title TEXT",
})
);
What I need now is to iterate through the String[] COLUMNS
field within each object within the array. I already have this but I know it is wrong. How can I do what I want with the loop for
:
for (TableHelper tables : Config.tableList){
for(TableHelper col : tables.columns()){
Log.e("COLUMN", tables2.toString());
}
}