I didn\'t even know this was doable, but I saw while perusing some code online a method with a signature like this:
public List read( ... )
>
It is possible that this method signature was created as a by-product of some generic class.
For example, SwingWorker
has two type parameters, one for final result and one for intermediate results. If you just don't want to use any intermediate results, you pass Void
as the type parameter, resulting in some methods returning Void
- i.e. nothing.
If there were a method List
in SwingWorker
with Void
as the type parameter V
, it would have created a method just like you posted in your question.
The code would be perfectly valid. You can instantiate any implementation of the List
interface (e.g. ArrayList
) with type parameter Void
. But the only value a Void
type can have is null
. So the list could not hold anything else but null
s, if the implementation allows null
elements.