Back to project page Learn-From-Me.
The source code is released under:
Apache License
If you think the Android project Learn-From-Me listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.overnightApps.myapplication.app.ui.optionsMenus; //from w ww .j a v a 2 s . co m import junit.framework.Assert; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class MenuOptionsBuilder { private final List<MenuItem> items; private final Map<Integer, MenuItem> itemMap; public MenuOptionsBuilder(List<MenuItem> items, Map<Integer, MenuItem> itemMap) { this.items = items; this.itemMap = itemMap; } public static MenuOptionsBuilder newInstance() { return new MenuOptionsBuilder(new ArrayList<MenuItem>(), new HashMap<Integer, MenuItem>()); } public MenuOptionsBuilder addItem(MenuItem item) { Assert.assertFalse(itemMap.containsKey(item.id)); items.add(item); itemMap.put(item.id, item); return this; } public MenuOptions createMenuOptions() { return new MenuOptions(items, itemMap); } }