Diamond syntax alternative for JDK 1.6

8.1k Views Asked by At

Could anyone suggest how the code below could be re-written such that it works with JDK 1.6, please?

private Map<SocketChannel, byte[]> dataTracking = new HashMap<>();
1

There are 1 best solutions below

0
Mureinik On

Java 6 doesn't support the diamond operator. You'll have to copy the generic specification to the new call too:

private Map<SocketChannel, byte[]> dataTracking = new HashMap<SocketChannel, byte[]>();