100_lecture32

100_lecture32 - Introduction to Computation and Problem...

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

View Full Document Right Arrow Icon
Introduction to Computation and Problem Solving Prof. Steven R. Lerman and Dr. V. Judson Harward Class 32: Class 32: The Java Collections Framework The Java Collections Framework 2 Goals To introduce you to the data structure classes that come with the JDK; To talk about how you design a library of related classes To review which data structures are the best tools for a variety of algorithmic tasks 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
3 History Vector Stack Vector Hashtable HashMap Dictionary Dictionary Hashtable . Enumeration and Vector . In the original version of the Java Development Kit, JDK 1.0, developers were provided very few data structures. These were: : which extended : very similar to our implementation of : an abstract class that defined the interface and some functionality for classes that map keys to values. served as the base class for : was a simple version of our Iterator that allowed you to iterate over instances of Hashtable 4 The Java Collections Framework a formal part of the JDK in version 1.2. s/index.html . The Java designers realized that this set of data structures was inadequate. They prototyped a new set of data structures as a separate toolkit late in JDK 1.1, and then made it This later, fuller, better designed set of classes is called the Java Collections Framework. There is a good tutorial on its use at http://java.sun.com/docs/books/tutorial/collection 2
Background image of page 2
5 Collections Interfaces, 1 Map SortedMap Collection List Set SortedSet Iterator ListIterator 6 Collections Interfaces, 2 Collection set Set List : adds list semantics; that is, a sense of order and position SortedSet : adds order to set semantics; our without values could be implemented as a SortedSet : is the most basic interface; it has the functionality of an unordered list, aka a multi- , a set that doesn’t not check for duplicates. : adds set semantics; that is, it won't allow duplicate members. binary search tree that just consisted of keys 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
7 Collections Interfaces, 3 Map : the basic interface for data structures that an Entry SortedMap Iterator : our Iterator except that it is fail fast ; it ConcurrentModificationException Collection has been modified. ListIterator map keys to values; it uses an inner class called : a map of ordered keys with values; our binary search tree is a good example throws a if you use an instance after the underlying : a bidirectional iterator. 8 Collection Implementations The Java designers worked out the architecture of interfaces independently of any data structures. In a second stage they created a number of concrete implementations of the interfaces based on slightly more sophisticated versions of the data structures that we have been studying: Resizable Array : similar to the technique used for our Stack implementation. Linked List
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 17

100_lecture32 - Introduction to Computation and Problem...

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

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