public static int eepromSizeForItem(MenuItem item) {
        return MenuItemHelper.visitWithResult(item, new AbstractMenuItemVisitor<Integer>() {
            @Override
            public void visit(AnalogMenuItem item) {
                setResult(2);
            }

            @Override
            public void visit(BooleanMenuItem item) {
                setResult(1);
            }

            @Override
            public void visit(EnumMenuItem item) {
                setResult(2);
            }

            @Override
            public void visit(TextMenuItem item) {
                setResult(item.getTextLength());
            }

            @Override
            public void anyItem(MenuItem item) {
                setResult(0);
            }
        }).orElse(0);
    }
public static int eepromSizeForItem ( MenuItem item ) { return MenuItemHelper . visitWithResult ( item , new AbstractMenuItemVisitor < Integer > ( ) { @ Override public void visit ( AnalogMenuItem item ) { setResult ( 2 ) ; } @ Override public void visit ( BooleanMenuItem item ) { setResult ( 1 ) ; } @ Override public void visit ( EnumMenuItem item ) { setResult ( 2 ) ; } @ Override public void visit ( TextMenuItem item ) { setResult ( item . getTextLength ( ) ) ; } @ Override public void anyItem ( MenuItem item ) { setResult ( 0 ) ; } } ) . orElse ( 0 ) ; }
Gets the size of the eeprom storage for a given element type
@param item the item to determine eeprom size for
@return the eeprom storage needed.