Search Results

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

Page 1/1 | 1 

  • Compile Error Using MutableClassToInstanceMap with Generics

    - by user298251
    I am getting the following compile error "The method putInstance(Class, T) in the type MutableClassToInstanceMap is not applicable for the arguments (Class, Number)" on the putInstance method call. Does anyone know what I am doing wrong?? Thanks! public class TestMutableClassToInstanceMap { public final MutableClassToInstanceMap<Number> identifiers = MutableClassToInstanceMap.create(); public static void main(String[] args) { ArrayList<Number> numbers = new ArrayList<Number>(); numbers.add(new Integer(5)); TestMutableClassToInstanceMap test = new TestMutableClassToInstanceMap(numbers); } public TestMutableClassToInstanceMap(Collection<Number> numbers){ for (Number number : numbers) { this.identifiers.putInstance(number.getClass(), number); //error here } this.identifiers.putInstance(Double.class, 5.0); // This works } }

    Read the article

1