I am new to Java and trying to learn the various collections that programmers can use. I imported \"java.util\" into a scrapbook in Eclipse and inspected the following code.
Your Java version in Eclipse is set to 1.4, generics in java were introduced only in Java 5.
Change your JDK to 1.5 or above in eclipse that will resolve this issue.
You can check your JDK by Project - > Java Build Path - > Libraries
If here you see it being Java 1.5 or above then check the compiler Compliance is set to 5 and above.
You can check that Project - > Java Compiler
EDIT:
To add new jdk to Eclipse
Right click on Project - > Java Build Path - > Libraries - > Add Libraries - > JRE System Library - > Installed Libraries - > Add - > Standard VM - > Provide your installation location and press OK
Note in the list of Installed JRE, ensure that you check your Java 7.