Search Results

Search found 1 results on 1 pages for 'littlegreenman'.

Page 1/1 | 1 

  • Java generics conversion

    - by LittleGreenMan
    I have build a generic datacontainer and now I want to manipulate data depending on their type. However, I get an incompatable types warning. What am I doing wrong? Type _Value; public void set(Type t) throws Exception { if (_Value instanceof Integer && t instanceof Integer) { _Value = (((Integer) t - _MinValue + getRange()) % getRange()) + _MinValue; } else if (_Value instanceof Boolean && t instanceof Boolean) { _Value = t; } else throw new Exception("Invalid type"); }

    Read the article

1