tailieunhanh - Lecture note Java methods A & AB: Object-oriented programming and data structures: Chapter 19 - Maria Litvin, Gary Litvin

Chapter 19 - The java collections framework. In this chapter we discuss the Java collections from the perspective of a user (that is a software developer). Then we put them to work in a fairly large project: a toy stock exchange. | Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved. The Java Collections Framework (19, "Chapter"); 19- In this chapter we discuss the Java collections from the perspective of a user (that is a software developer). Then we put them to work in a fairly large project: a toy stock exchange. Objectives: Learn a subset of the Java collections framework Practice working on a realistic software project as a team 19- Java collections framework is quite large; here we present a subset required for the AP AB-level exam. Overview Framework (in software): a general system of components and architectural solutions that provides development tools to programmers for use with a relatively wide range of applications. Collection: (hmm.) any collection of elements 19- In general a framework is a support structure for something. Overview (cont’d) . | Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved. The Java Collections Framework (19, "Chapter"); 19- In this chapter we discuss the Java collections from the perspective of a user (that is a software developer). Then we put them to work in a fairly large project: a toy stock exchange. Objectives: Learn a subset of the Java collections framework Practice working on a realistic software project as a team 19- Java collections framework is quite large; here we present a subset required for the AP AB-level exam. Overview Framework (in software): a general system of components and architectural solutions that provides development tools to programmers for use with a relatively wide range of applications. Collection: (hmm.) any collection of elements 19- In general a framework is a support structure for something. Overview (cont’d) Collection, Iterator Lists, ListIterator List ArrayList LinkedList Stack Queue, PriorityQueue Sets Set TreeSet HashSet Maps Map TreeMap HashMap All these interfaces and classes are part of the package. Names of interfaces are in italics. 19- The most common way to use the collections framework is to create objects of library classes in your programs. However, you can also extend library classes and write your own classes that implement library interfaces. Overview (cont’d) 19- Some connections are not shown here because they muddy the concepts. For example, the Queue interface extends the Collection interface, but we want to use queues in a “pure” way, using only the four queue-specific methods: isEmpty, add, remove, peek. The same for Stack: strictly speaking it implements Collection, but we want to use only the four “pure stack” methods (isEmpty, push, pop, peek). Overview (cont’d) A collection holds references to objects (but we say informally that it “holds .