我基本上是一个 php 程序员,现在只是想知道(或徘徊!)在 java 海的岸边。当然还有救生艇,stackoverflow。
我正在努力在 java 中创建一个多维数组,就像在 php 中一样,这很可能$array["bla"]["blabla"]["blablabla"]...
这是我想要实现的
Array
(
[user] => UserName
[groups] => Array
(
[0] => group1
[1] => group2
[2] => group3
)
[categories] => Array
(
[0] => category1
[1] => category2
[2] => category3
)
[notification] => user notification string
[departments] => Array
(
[0] => department1
[1] => department2
[2] => department3
[3] => department4
)
[sub-deptmnt] => Array
(
[department1] => Array
(
[0] => subdep1
[1] => subdep2
)
[department2] => Array
(
[0] => another-subdep1
[1] => another-subdep2
[2] => another-subdep3
)
)
)
在 php 中是
$array["user"] = "UserName";
$array["groups"] = array("group1","group2","group3");
$array["categories"] =array("category1","category2","category3");
$array["notification"] = "user notification string";
$array["departments"] = array("department1","department2","department3","department4");
$array["sub-deptmnt"] = array("department1" => array("subdep1","subdep2"),"department2"=> array("another-subdep1","another-subdep2", "another-subdep3"));
有人请帮我继续前进..
编辑:使用 php 示例阐明所需的数组