groovy - Display 3 lists (java.util.List) -


i ask display 3 lists groovy. in fact have 3 lists (java.util.list) : first 4 checkboxes, second , third editable grids 1 column , 4 fields. saved in 3 differents variables java.util.list.

i try display 3 lists in text field area loop :

def out = [] (i=0; i<grids1.size();i++) {     out.add([grids1.getat(i),checkboxes.getat(i),grids2.getat(i)]) } out 

but result pretty bad.

    [[[], checkboxes, []], [[2], checkboxes, [grids2]], [[], null, []],  [[3], null, [grids2]], [[], null, []]] 

could me ?

more info answer below:

thanks. not in dark because it's that! have gap between each data. example :

3 lists 4 fields each.

def = [ [], [2], [], [4] ] def b = [ '', 'two', '', 'four' ] def c = [ [], [6], [], [8] ] 

it display that, lag (maybe because lists a , c keep index counter b list.

[[], two, []] [[2], four, [6]] [[], , [], []] [[4], , [], [8]] 

the list , b keep "positions" opposed list b.

without knowing input data is, or output desire (maybe add example inputs , required outputs question?), complete shot in dark...

you can sort of thing:

def = [ [ 1, 2 ], [], [ 3, 4 ] ] def b = [ 'one', 'two', 'three' ] def c = [ [], [ 5, 6 ], [ 7, 8 ] ]  string s = [a,b,c].transpose()              // join lists                   .collect { it.findall() } // remove empty entries                   .join( '\n' )             // join string newlines println s 

which prints:

[[1, 2], one] [two, [5, 6]] [[3, 4], three, [7, 8]] 

but say, it's hard know if going in right direction...

edit after update:

this:

def = [ [], [2], [], [4] ] def b = [ '', 'two', '', 'four' ] def c = [ [], [6], [], [8] ]  string s = [ a, b, c ].transpose().join( '\n' )  println s 

prints:

[[], , []] [[2], two, [6]] [[], , []] [[4], four, [8]] 

is closer?


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -