Diamond syntax alternative for JDK 1.6

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<>();
7

1 Answer

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[]>();

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like