CSC153, Class 47: Linked Lists Overview: * Deletion in array-based lists * Packages in Java * Implementing Scheme-like lists + The Node class * Variations Notes: * Lots of housework last night. No grading of exam. No grading of homework. No class prep. Bleh. * No more homework in CSC153. Horray! * Math/CS Picnic, Friday, 2 May 2003 (optional). Be there and be square. ---------------------------------------- Packages in Java A package is a group of classes that naturally work together. Why have packages? * Modularity * Protection: We may want to make components of an object available only to other objects in the same package. Naming strategy for packages Traditionally "reverse domain" + "project" edu.grinnell.cs.csc153.2003S.lists For now, we'll use the simpler "project" name linkedlists You need to make a directory (or hierarchy of directories) for your package Each class in the package must begin with package PACKAGENAME; Compile above the top-level directory with javac package/file.java Packages are there to encourage good style, not to enforce it. ---------------------------------------- Return to our study of lists in Scheme. Recall that all lists are built from pairs. Each pair stores two things: a pointer to a value and a poitner to the next thing. A pair is really easy to implement in Java. Traditional programmers call these "Nodes". ---------------------------------------- FOR NEXT TIME: * Nicely chastise Katherine Gray for skipping class. * Think about cursors in linked lists.