11.07.2015 Views

Introduction to Programming Using Java - Department of ...

Introduction to Programming Using Java - Department of ...

Introduction to Programming Using Java - Department of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CONTENTSvii9.4 Binary Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4559.4.1 Tree Traversal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4569.4.2 Binary Sort Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4589.4.3 Expression Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4639.5 A Simple Recursive Descent Parser . . . . . . . . . . . . . . . . . . . . . . . . . . 4669.5.1 Backus-Naur Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4669.5.2 Recursive Descent Parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . 4689.5.3 Building an Expression Tree . . . . . . . . . . . . . . . . . . . . . . . . . . 472Exercises for Chapter 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475Quiz on Chapter 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47810 Generic <strong>Programming</strong> and Collection Classes 48010.1 Generic <strong>Programming</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48010.1.1 Generic <strong>Programming</strong> in Smalltalk . . . . . . . . . . . . . . . . . . . . . . 48110.1.2 Generic <strong>Programming</strong> in C++ . . . . . . . . . . . . . . . . . . . . . . . . 48210.1.3 Generic <strong>Programming</strong> in <strong>Java</strong> . . . . . . . . . . . . . . . . . . . . . . . . . 48310.1.4 The <strong>Java</strong> Collection Framework . . . . . . . . . . . . . . . . . . . . . . . . 48410.1.5 Itera<strong>to</strong>rs and for-each Loops . . . . . . . . . . . . . . . . . . . . . . . . . . 48610.1.6 Equality and Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . 48710.1.7 Generics and Wrapper Classes . . . . . . . . . . . . . . . . . . . . . . . . 49010.2 Lists and Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49110.2.1 ArrayList and LinkedList . . . . . . . . . . . . . . . . . . . . . . . . . . . 49110.2.2 Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49410.2.3 TreeSet and HashSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49510.2.4 EnumSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49810.3 Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49910.3.1 The Map Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50010.3.2 Views, SubSets, and SubMaps . . . . . . . . . . . . . . . . . . . . . . . . 50110.3.3 Hash Tables and Hash Codes . . . . . . . . . . . . . . . . . . . . . . . . . 50410.4 <strong>Programming</strong> with the Collection Framework . . . . . . . . . . . . . . . . . . . . 50610.4.1 Symbol Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50610.4.2 Sets Inside a Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50710.4.3 <strong>Using</strong> a Compara<strong>to</strong>r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51010.4.4 Word Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51210.5 Writing Generic Classes and Methods . . . . . . . . . . . . . . . . . . . . . . . . 51410.5.1 Simple Generic Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51510.5.2 Simple Generic Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51610.5.3 Type Wildcards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51810.5.4 Bounded Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522Exercises for Chapter 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526Quiz on Chapter 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53011 Files and Networking 53111.1 Streams, Readers, and Writers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53111.1.1 Character and Byte Streams . . . . . . . . . . . . . . . . . . . . . . . . . 53111.1.2 PrintWriter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53311.1.3 Data Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53411.1.4 Reading Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!