File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multidim array initialize

 
Miran Cvenkel
Ranch Hand
Posts: 172
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2D array, first dim = string, the second = array
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because your reference only has two dimensions you can only use two dimensions in the shortcut syntax. The following will do exactly the same but will work:
I think the reason is that the actual type of the other arrays can no longer be determined. The first two dimension types can be read from the reference type, but after that it's not possible to see if it should be Object, String or anything else.
 
Miran Cvenkel
Ranch Hand
Posts: 172
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

Do you see here, why test is lenght 2 which I think it should be 1
and filter length is 9 which is what it what I want ?

 
Miran Cvenkel
Ranch Hand
Posts: 172
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
figured out, instead of:

it should be


I don't know why it was all the time giving me syntax error before, on that.
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The elements of tests:
0: {"type","s"}
1: {"nomenclature","s"}

The elements of filter:
0: {"Data",new Object[][]{}}
1: {"Table",new Object[][]{}}
2: {"Information",new Object[][]{}}
3: {"Group",test}
4: {"Group",new String[][]{{"type"}, {"language"}}}
5: {"Group",new String[][]{{"type"}, {"dictionary"}}}
6: {"Element",new String[][]{{"name", "code"},new String[]{"value", "tag00061"}}}
7: {"AttList",new String[][]{}}
8: {"Att",new String[][]{{"name"}, {"label"}}}
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic