Do you want an object representation of a long, or just the number (the primitive) ?
Primitives (int, long etc.) can be interchanged with their object equivalents (Integer
, Long
etc.). If you use the object variants they can then be inserted in collections that normally take objects (e.g. Map
, List
, Set
) and used wherever an Object
is expected. I would, however, normally expect you to be using the primitive variant for most applications.
It's worth looking at this SO question for more information on the pros/cons.