Java Question Stucked Here

jahswant

Well-Known Member
Licensed User
Longtime User
B4X:
    private ArrayList<ArrayList<String>> createContent(int row, int column) {
        ArrayList<ArrayList<String>> results = new ArrayList<>();
        for (int i = 0; i < row; i++) {
            ArrayList<String> strings = new ArrayList<>();
            for (int j = 0; j < column; j++) {
                strings.add("$" + i + "" + j);
            }
            results.add(strings);
        }
        return results;
    }

How to convert this to B4A my translation always fails.
 

Roycefer

Well-Known Member
Licensed User
Longtime User
B4X:
Private Sub CreateContent(row As Int, column As Int) As List
     Dim results As List
     results.Initialize
     For i = 0 To row-1
          Dim strings As List
          strings.Initialize
          For j = 0 to column-1
               strings.Add("$" & i & "" & j)  'I suspect that the "" is not strictly necessary in B4X
          Next
          results.Add(strings)
     Next
     Return results
End Sub

Beware, untested.
 
Top