Code example for WeakHashMap

0
 
public class MenuWrapper implements Menu {
    private final android.view.Menu mNativeMenu;
 
    private final WeakHashMap<android.view.MenuItem, MenuItem> mNativeMap =
            new WeakHashMap<android.view.MenuItem, MenuItem>();
 
 
    public MenuWrapper(android.view.Menu nativeMenu) {
        mNativeMenu = nativeMenu;
    } 
 
    public android.view.Menu unwrap() {
        return mNativeMenu;
    } 
 
    private MenuItem addInternal(android.view.MenuItem nativeItem) {
        MenuItem item = new MenuItemWrapper(nativeItem);
        mNativeMap.put(nativeItem, item);
        return item;
Contextual code suggestions in your IDE  Get Codota for Java