JB Header
How to Resolve - Syntax error, insert "Dimensions" to complete ReferenceType
If you are getting the following error at compile time or in your IDE -
Syntax error, insert "Dimensions" to complete ReferenceType

Cause of this error - You are trying to pass a primitive object into a generic type declaration whereas generic types always expect a Wrapper Class object.
(Note - To know more about Wrapper Classes check-out this tutorial Click to read Wrapper Classes tutorial)

Examples error scenarios -
  1. java.util.function.Function<T ,R> expects 2 arguments T and R where T is the input to the function and R is the result. Both T & R being generic types need to be Wrapper objects i.e. if you define -
    Function<List<Integer>,boolean> isPartOf=(List<Integer> listInt, Integer value) -> listInt.contains(value); 
    -- this will give the insert "Dimensions" error as boolean is a primitive
    Resolution: give Boolean (wrapper class) in place of boolean. The corrected statement would be -
    Function<List<Integer>,Boolean> isPartOf=(List<Integer> listInt, Integer value) ->listInt.contains(value);
  2. java.util.Map<K,V> and java.util.HashMap<K,V> both expect Wrapper type of objects in place of K and V. Now if you take the statement -
    Map<String, int> intMap = new HashMap<String, int>();
    -- this will give the insert "Dimensions" error as Map's & Hashmap's generic type V should be Wrapper-type Integer and not primitive int as defined above. Hence, the corrected statement would be -
    Map<String, Integer> intMap = new HashMap<String, Integer>();