我試圖控制我的應用程序的一些權限。 昨天我學習瞭如何創建雙Brace初始化,它幫助了很多。但現在我想用它嵌套的,但我從IDE(Android Studio中)使用HashMap和List進行嵌套雙括號初始化
這裏得到一個
')' expected
是我的代碼:
public static final Map<String, List> ALL_PERMISSIONS = new HashMap<String, List>() {{
put("Change-maps", new ArrayList<Integer>(){{add(R.id.button_change_view);}};);
put("Stores-info-view", new ArrayList<Integer>(){{add(R.id.details_fragment);}};);
put("Competitors-layer", new ArrayList<Integer>(){{add(R.id.switch_concorrentes);}};);
}};
我錯過東西在裏面? 是一個壞的方法?
PS:我正在嘗試這種方法,因爲將來我會使用一些具有多個View(Integer)的鍵和一些具有String列表的鍵。
似乎你錯過了')'在某處......只是檢查大括號小心。 – Yurets