.. This file is part of the OpenDSA eTextbook project. See .. http://opendsa.org for more details. .. Copyright (c) 2012-2020 by the OpenDSA Project Contributors, and .. distributed under an MIT open source license. .. avmetadata:: :author: Molly Generics Intro ============== Objectives ---------- * Declare variables and instantiate objects that are generic types and take a type parameter * Trace code that demonstrates the use of both generics and inheritance * Design and write a generic class * Write and use generic methods * Assess the software engineering benefits of using generic methods * Assess the benefits and possible tradeoffs of using generic types vs Object type Suggested Reading ~~~~~~~~~~~~~~~~~ **Java Interlude 1 Generics** from `Data Structures and Abstractions with Java `_ by Frank M. Carrano and Timothy Henry Interactive: Generics Intro Video [9:50] ---------------------------------------- .. admonition:: Follow Along, Practice and Explore Download to run and explore the java file (see below) from the video on your own in eclipse. You may download the standalone \*.java file for this example. To run the standalone \*.java file you will need to 1) create a new Eclipse project, then 2) create a package within the project called “example” (the package named at the top of the class MUST match the package the file is placed in within the Eclipse project), and finally 3) download and import the standalone \*.java file(s) to the created package. .. raw:: html ArrayBasics.java .. raw:: html
Checkpoint 1 ------------ .. avembed:: Exercises/SWDesignAndDataStructs/Generics1Checkpoint1Summ.html ka :long_name: Checkpoint 1