iterators - Computer Science 211 Data Structures Mount...

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

View Full Document Right Arrow Icon
Computer Science 211 Data Structures Mount Holyoke College Fall 2009 Topic Notes: Iterators Interfaces and Abstract classes Before we discuss Iterator s, we need to think about the design of abstract data types in Java. So far, we have seen interfaces and regular classes. There is a level between these called an abstract class . The abstractions provided by interfaces and abstract classes are important for the development of reusable and modular software. We want to be able to define what an abstract data type does without committing to how it does it. The biggest example we’ve seen so far is a Vector . As the user of a Vector , we know we can create them, add, retrieve, remove, and modify elements in them, and query information like their size. All of these are independent of how the Vector is implemented. This separation of the public interface from the implementation allows programmers to make use of Vector s without needing to know how things work on the inside. It also allows the implementers of Vector s to make internal changes without affecting other code that uses it, so long as the public interface does not change. Java has language constructs to support the development of abstract data types. Interfaces describe the public functionality of an abstract data type. This includes: method signatures constants An interface may extend another interface . We have seen and used
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/15/2010.

Page1 / 4

iterators - Computer Science 211 Data Structures Mount...

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

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