Uses for the Java Void Reference Type?

Void has become convention for a generic argument that you are not interested in. There is no reason why you should use any other non-instantiable type, such as System.

It is also often used in for example Map values (although Collections.newSetFromMap uses Boolean as maps don’t have to accept null values) and java.security.PrivilegedAction.

Leave a Comment