11-21 Class Notes CS 107

11-21 Class Notes CS 107 - Today: How can we read in first...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Class Wednesday will be a video lecture on recursively reversing a linked list. This example is an opportunity to combine everything we've learned so far this semester: variables, if statements, loops, parameters, recursion, linked lists. (I often place a variant of this problem on the final exam.) A solution to program #5 has been posted. Take a look, particularly if you did not get it to work. Announcements: How to copy an ArrayList (See posting in Piazza) Use the ArrayList copy constructor: ArrayList<String> newArrayList = new ArrayList<String>( existingArrayList); Questions? Using ArrayLists: declaring, adding an element, retrieving elements, removing elements. Last Time: Comments on Program #6: Linked lists: Intuition, creating a list, traversing a list
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Today: How can we read in first an int (for the wordSize) and then later a String? The problem is that after typing in the int, the carriage-return character is buffered . 1. We need to read the entire line containing the int, and then extract it using: Integer.parseInt( theString); Given an ArrayList and a letter, how can we remove elements from the list that contain that letter? Part of the answer is using the contains(&quot;&quot;+theLetter) method, converting theLetter to a String. 2. Program #6 comments: 11-21 Class Notes CS 107 Monday, November 21, 2011 10:37 AM CS 107 Fall 2011 Page 1 Linked List: CS 107 Fall 2011 Page 2 CS 107 Fall 2011 Page 3 CS 107 Fall 2011 Page 4...
View Full Document

Page1 / 4

11-21 Class Notes CS 107 - Today: How can we read in first...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online