The document discusses teaching the Java Collections Framework to students. It notes that the framework classes are not treated as black boxes, but rather their headings, fields, and method definitions are examined to help students understand how professionals' code works efficiently and succinctly. It also mentions that the version of the Java Collections Framework being used includes type parameters, which were added in Java 5.0, and help detect errors at compile-time rather than run-time by eliminating the need to downcast collection return values. Finally, it states that boxing, unboxing, and enhanced for statements were added to complement generics.
The document discusses teaching the Java Collections Framework to students. It notes that the framework classes are not treated as black boxes, but rather their headings, fields, and method definitions are examined to help students understand how professionals' code works efficiently and succinctly. It also mentions that the version of the Java Collections Framework being used includes type parameters, which were added in Java 5.0, and help detect errors at compile-time rather than run-time by eliminating the need to downcast collection return values. Finally, it states that boxing, unboxing, and enhanced for statements were added to complement generics.
The document discusses teaching the Java Collections Framework to students. It notes that the framework classes are not treated as black boxes, but rather their headings, fields, and method definitions are examined to help students understand how professionals' code works efficiently and succinctly. It also mentions that the version of the Java Collections Framework being used includes type parameters, which were added in Java 5.0, and help detect errors at compile-time rather than run-time by eliminating the need to downcast collection return values. Finally, it states that boxing, unboxing, and enhanced for statements were added to complement generics.
Second, the framework is available for later courses in the
curriculum and beyond. Third, although the primary emphasis is on using the Java Collections Framework, the framework classes are not treated simply as “black boxes.” For each such class, the heading and field are provided, and one method definitio is dissected. This exposition takes away some of the mystery that would otherwise surround the class, and allows students to see the eff ciency and succinctness of professionals’ code. The version of the Java Collections Framework we will be working with includes type parameters. Type parameters, sometimes called “generic types,” “generics,” or “templates,” were added to the Java language starting with Java 5.0. With type parameters, there is no need to downcast the return value from a collection, and many errors can be detected at compile-time that previously were discoverable only at run-time. To complement generics, three other features have been added: boxing, unboxing, and an enhanced for statement. The elements in generic collections must be objects, often from a wrapper class such as Integer. If a primitive value appears where a collection method requires a wrapper element as an argument, boxing automatically converts the primitive value to the corresponding wrapper element. C