CSC297.Java, Class 14: Lists Admin: * Bishop's latest assignment: Histogram, due Wed. * Sam's latest assignment: Test the various versions of cdr. * Sam's other assignment: Think about how to make addToFront more efficient. * Centering Overview: * Review: A List Interface * Question: How would *you* implement this interface * Technique one: Arrays * Technique two: Cons cells (Pairs) Notes on Centering // An idea: Put width/2 spaces on the left and width-1-width/2 spaces // on right. // A problem: If the object requires more than one space, you're screwed. // Revised idea: // (1) Determine the length of "the string". // (2) Subtract that length from width. // (3) Follow the earlier strategy // A concern: What if the string is longer than the width? // (a) Throw an exception. // (b) Truncate the string. [Dictatorial selection] // (c) Just print the string as is. [Popular Vote] Important Morals: * It works because *any* object can be converted to a sting. (A wonder of polymorphism.) * When you need to print a long string of similar characters, a substring command may be more efficient than a for loop. (It looks more clever, at the very least.) * You should be able to solve problems like this.