No, this is not possible. Use Integer
instead. Autoboxing takes care of the rest (i.e. for most purposes you can program as if you had actually used int
because Java converts to and from Integer
automatically for you).
More Related Contents:
- Why don’t Java Generics support primitive types?
- Is there a way to refer to the current type with a type variable?
- What’s the difference between primitive and reference types?
- Java Raw Type and generics interaction
- Reflection for Class of generic parameter in Java?
- Dynamically find the class that represents a primitive Java type
- How can I determine the type of a generic field in Java?
- Java interfaces and return types
- Which one to use, int or Integer
- List is a raw type. References to generic type List should be parameterized
- What is PECS (Producer Extends Consumer Super)?
- Java Generics (Wildcards)
- What does the question mark in Java generics’ type parameter mean? [duplicate]
- Create instance of generic type in Java?
- Why can’t I use a type argument in a type parameter with multiple bounds?
- Why can’t a Generic Type Parameter have a lower bound in Java?
- Why does this generic code compile in java 8?
- How to create a class literal of a known type: Class
- Java nested generic type
- Why shouldn’t Java enum literals be able to have generic type parameters?
- Java: Casting from List to List when B implements A?
- What does “Recursive type bound” in Generics mean?
- array of parameterized types
- Java-syntax for explicitly specifying generic arguments in method calls
- Troubleshooting “The type parameter T is hiding the type T” warning
- Java Generic with ArrayList
- How to convert IEEE-11073 16-bit SFLOAT to simple float in Java?
- How to write a generic method that takes two arguments of the same types in java?
- Java generics: wildcard vs type parameter?
- Provide an iterator over the contents of two lists simultaneously?