{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Class 26 - Arrays and Lists in Java continued 1 Goals for...

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

View Full Document Right Arrow Icon
Arrays and Lists in Java, continued 1
Background image of page 1

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

View Full Document Right Arrow Icon
Goals for Today n Solve problems using Java’s LinkedList data structure n Solve problems using Java’s ArrayList data structure 2 MGMT 29000-002
Background image of page 2
Lists in Java n Interface: a structure that only declares methods n A class implementing an interface defines methods n Example: String implements CharSequence n Java’s List is an interface n Two classes implementing List ¨ LinkedList : similar to Alice’s list data structure ¨ ArrayList : dynamic container offering fast access MGMT 29000-002 3
Background image of page 3

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

View Full Document Right Arrow Icon
Lists in Java (continued) MGMT 29000-002 4
Background image of page 4
Lists in Java (continued) MGMT 29000-002 5
Background image of page 5

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

View Full Document Right Arrow Icon
Example: Managing the Waiting Room n Essential elements of user story for WaitingRoom ¨ Read an appointment list file named “ today.txt ¨ Repeatedly admit patients ¨ Exit loop when all patients have arrived or been seen n Key members in implementation of WaitingRoom ¨ Two LinkedList s to model two patient lists ¨ A Scanner object for reading keyboard input ¨ A constructor to build the waiting and appointment lists ¨ A method to read the waiting list from the file ¨ Two methods for processing the arrival MGMT 29000-002 6
Background image of page 6
Example: Managing the Waiting Room (continued) MGMT 29000-002 7
Background image of page 7

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

View Full Document Right Arrow Icon
Example: Managing the Waiting Room (continued) MGMT 29000-002 8
Background image of page 8
Example: Managing the Waiting Room (continued) MGMT 29000-002 9
Background image of page 9

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

View Full Document Right Arrow Icon
Using LinkedList s n Rules for declaring a linked list ¨ The type of a linked list must be a reference type ¨ Use a wrapper class when a primitive type is needed n Wrapper class contains primitive type plus operations n Pattern for declaring a
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}