1

SparseArray<Object> is great a way to avoid autoboxing if you want to use a primitive key. What if you want to use a primitive value? Something like SparseArray<int> (if it existed)?

I want to make an int to an int.

ZakTaccardi
  • 12,212
  • 15
  • 59
  • 107

1 Answers1

3

There is no way to do it. Java does not allow primitive types to be used as type arguments in generic types. You'll have to use the wrapper type Integer.

M A
  • 71,713
  • 13
  • 134
  • 174