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

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

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest