object-oriented design and programming (java). 2 topics covered today 2.2 collections –2.2.1...

54
Object-Oriented Design and Programming (Java)

Upload: kelly-hamilton

Post on 31-Dec-2015

224 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

Object-Oriented Design and Programming (Java)

Page 2: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

2

Topics Covered Today

• 2.2 Collections– 2.2.1 Arrays– 2.2.2 Vectors and Iterators– 2.2.3 Implementing the Collections of the Library

System

Page 3: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

3

What is a Collection?

• A “collection” object — sometimes called a container — is simply an object that groups multiple elements into a single unit

• Collections are used to store, retrieve, manipulate, and communicate aggregate data

• Typically, they represent data items that form a natural group, such as a poker hand (a collection of cards), a mail folder (a collection of letters), or a telephone directory (a mapping of names to phone numbers).

Page 4: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

4

Array

• Group data objects of the same type – 数组是同类数据的集合– 数组中的每一项叫元素( element ),用 [] 和下标

值(整型)来访问,下标值从 0 开始;• Declare arrays

char ch[]; or char[] ch;– Create space for a reference– Remember an array is an object not memory reserved

for primitive types

Page 5: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

5

Creating an Array

• Use the new keyword to create an array object

• The statement in the sample program allocates an array with enough memory for ten integer elements and assigns the array to the variable anArray declared earlier.

new dataType[arraySize]

int[] anArray = new int[10];

Page 6: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

6

Accessing an Array Element

• Now that some memory has been allocated for the array, the program assign values to the array elements:

• Note that in Java, array indices begin at 0 and end at the array length minus 1.

for (int i=0; i<anArray.length; i++) {

anArray[i] = i;

System.out.print(anArray[i] + " ");

}

Page 7: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

7

Example Arrayclass ArrayDemo {

public static void main(String[] args) {

// declare an array of integers and create an array of integers

int[] anArray = new int[10];

// assign a value to each array element and print

for (int i=0; i< anArray.length; i++) {

anArray[i] = i;

System.out.print(anArray[i] + " ");

}

System.out.println();

}

}

Page 8: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

8

Initializing an array

• Java provides a shortcut syntax for creating and initializing an array. – int[] x = { 1, 3, 5, 7, 9 };– String[] strDays = { “Mon, ”Wed”, ”Fri” };– boolean[] answers = { true, false, true, true };

Page 9: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

9

Arrays Summary

• The size of an array is fixed at the time it is created and can not be changed afterwards.

• Any attempt to access an element outside the length of an array will throw an IndexOutOfBoundsException.

• All the elements stored in the array must be of the same type or class.

• An array has a public attribute called length which indicates the number of elements that it contains.

• The elements contained in an array can also be arrays! (And the elements in those arrays can be arrays, and so on …). These are known as multi-dimensional

Page 10: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

10

java.util.Vector

• Package java.util

• The Vector class implements a growable array of objects. – The size of a Vector can grow or shrink as needed to

accommodate adding and removing items after the Vector has been created.

– The objects in the vector can be accessed using an integer index.

Page 11: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

11

methods defined in class Vector

• Vector(). 构造器;• int size(). 返回 vector 中对象的个数; • boolean isEmpty(). 判断 vector 中是否还有对象; • boolean contains(Object elem). 判断制定的对象是否在 vector 中; • boolean add(Object o). 将指定的对象添加在 vector 的末尾; • void add(int index, Object element). 在指定的位置添加指定的对象,

向后移动其他的元素; • Object get(int index). 返回指定位置的对象; • public Object set(int index, Object element). 用指定的对象替换指定位

置的对象元素; • public boolean remove(Object o). 将指定的对象在第一次出现的位置

处删除,后面的元素依次前移; • Object remove(int index). 将指定位置的对象从 vector 移走并且后面

的对象依次前移后,将该对象返回;

Page 12: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

12

using Vectorimport java.util.Vector;

public class test {

public static void main(String[] args) {

Vector vector = new Vector();

vector.add("Hello");

vector.add(new Integer(10));

vector.add(new Employee("John Smith"));

String string = (String) vector.get(0);

Integer integer = (Integer) vector.get(1);

Employee employee = (Employee) vector.get(2);

System.out.println(string);

System.out.println(integer);

System.out.println(employee);

} }

Page 13: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

13

Generic Types in Java 5

• When using a collection (e.g., LinkedList, HashSet, HashMap), we generally have a single type T of elements that we store in it (e.g., Integer, String)

• Before 1.5, when extracting an element, had to cast it to T before we could invoke T's methods

• Compiler could not check that the cast was correct at compile-time, since it didn't know what T was

• Inconvenient and unsafe, could fail at runtime

Page 14: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

14

Generic Types in Java 5.

• Generics in Java 1.5 provide a way to communicate T, the type of elements in a collection, to the compiler – Compiler can check that you have used the collection

consistently – Result: safer and more-efficient code

Page 15: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

15

Vector (Using Generic Type)

• Before JDK5.0:

• JDK5.0

String string = (String) vector.get(0);

  Vector<String> vector = new Vector<String>();  vector.add("Hello");  String hello = vector.elementAt(0);

Page 16: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

16

The ArrayList Class

• The class java.util.ArrayList<E> implements a collection of objects that can grow to accommodate new items when the collection is full.

Page 17: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

17

Methods Defined in Class ArrayList

• ArrayList(). Constructs an empty collection. • int size(). Returns the number of objects in the collection. • boolean isEmpty(). Determines if there are no objects in the collection. • boolean contains(Object elem). Determines if the specified object is an

element of the collection (as determined by the method equals). • boolean add(E o). Appends the specified object to the end of the collection. • void add(int index, E element). Inserts the specified object at the specified

index position, shifting any subsequent elements to the right (adds one to their indices).

• E get(int index). Returns the object at the specified position. • public E set(int index, E element). Replaces the element at the specified

index position with the specified object. • public boolean remove(Object o). Removes the first occurrence of the

specified object (using method equals), shifting any subsequent elements to the left (subtracts one from their indices).

• E remove(int index). Returns the object at the specified position after first removing it from the collection and shifting any subsequent elements to the left (subtracts one from their indices).

Page 18: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

18

ArrayList Example

ArrayList<Employee> employees =

new ArrayList<Employee>();

employees.add(new Employee("John Smith"));

employees.add(new Employee("Mary Williams"));

employees.add(new Employee("Peter Jefferson"));

Employee firstEmployee = employees.get(0);

Page 19: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

19

ArrayList Example

ArrayList<Integer> numbers =

new ArrayList<Integer>();numbers.add(1);int num = numbers.get(0);

Page 20: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

20

java.util.Iterator<E>

• An iterator is an object for traversing a vector from start to finish.– Iterator 是一个用于遍历 Vector 中的每个元素的对象

• The ArrayList method iterator() returns a java.util.Iterator<E> object over the elements

• Methods of Iterator :– boolean hasNext(). Returns true if the iteration has

more elements. – E next(). Returns the next element in the iteration. – void remove(). Removes from the collection the last

element returned by the iterator.

Page 21: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

21

Using Iterator

ArrayList<String> list = new Arralist<String>(); list.add("ArrayList");list.add(" and "); list.add("Iterators");

String result = "";

for (Iterator<String> listIterator = list.iterator(); listIterator.hasNext(); ) { result += listIterator.next(); } stdout.println(result);

Page 22: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

22

Using the For-Each Loop in Collections

ArrayList<String> list = new Arralist<String>();

list.add("ArrayList");

list.add(" and ");

list.add("for-each");

String result = "";

for (String element : list) {

result += element;

}

stdout.println(result);

Page 23: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

23

Implementing Collection Class

Page 24: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

24

Implement class Client

import java.util.*;public class Client implements Iterable<BankAccount> {

/* Name of client */ private String name;

/* Collection of <code>BankAccounts</code> objects.*/

private ArrayList<BankAccount> accounts;

Page 25: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

25

Implement class Client /** * Constructs a <code>Client</code> object. * <p> * Creates an empty collection of bank accounts. * </p> * * @param initialName the name of the client. */ public Client(String initialName) {

this.name = initialName; this.accounts = new ArrayList<BankAccount>(); }

Page 26: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

26

Implement class Client

/**

* Adds a bank account to this client.

*

* @param bankAccount the {@link BankAccount} object.

*/

public void addAccount(BankAccount bankAccount) {

this.accounts.add(bankAccount);

}

Page 27: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

27

Implement class Client

/** * Returns an iterator over the bank accounts of this client. * * return an {@link Iterator} over the bank accounts of this * client. */ public Iterator<BankAccount> iterator() { return this.accounts.iterator(); }

Page 28: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

28

Implement class Client

/**

* Returns the number of bank account of this client.

*

* @return the number of bank account of this client.

*/

public int getNumberOfAccounts() {

return this.accounts.size();

}

}

Page 29: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

29

TestClient.java

public class TestClient { private static PrintWriter stdOut = new PrintWriter(System.out, true); private static PrintWriter stdErr = new PrintWriter(System.err, true); public static void main(String[] args) { BankAccount accountOne = new BankAccount(); BankAccount accountTwo = new BankAccount(); BankAccount accountThree = new BankAccount(); accountOne.deposit(1000.0); accountTwo.deposit(2000.0); accountThree.deposit(3000.0); Client client= new Client("John Smith"); client.addAccount(accountOne); client.addAccount(accountTwo); client.addAccount(accountThree);

Page 30: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

30

TestClient.java

double totalBalance = 0.0; for (BankAccount account : client) { totalBalance += account.getBalance(); } if (totalBalance != 6000.0) { stdErr.println("** Test failure"); } stdOut.println("done"); } }

Page 31: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

ArrayList 、 Vector 差异

31

一 . 同步性 :Vector 是线程安全的,也就是说是同步的,而 ArrayList 是线程序不安全的,不是同步的

二 . 数据增长 : 当需要增长时 ,Vector 默认增长为原来一培,而 ArrayList 却是原来的一半

Page 32: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

32

Class Diagram

Page 33: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

33

Class Catalog

import java.util.*;import java.io.*;

/** * Maintains the information of a library catalog. Contains a * collection of {@link CatalogItem} objects. * * @author author name * @version 1.0.0 * @see CatalogItem */public class Catalog implements Iterable<CatalogItem> {

/* Collection of <code>CatalogItem</code> objects.*/ private ArrayList<CatalogItem> items;

Page 34: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

34

Class Catalog

/**

* Constructs an empty catalog.

*/

public Catalog() {

this.items = new ArrayList<CatalogItem>();

}

Page 35: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

35

Class Catalog

/** * Adds a {@link CatalogItem} object to this catalog. * * @param catalogItem the {@link CatalogItem}

object. */ public void addItem(CatalogItem catalogItem) {

this.items.add(catalogItem);

}

Page 36: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

36

Class Catalog

/** * Returns an iterator over the items in this catalog. * * return an {@link Iterator} */ public Iterator<CatalogItem> iterator() {

return this.items.iterator();

}

Page 37: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

37

Class Catalog /** * Returns the {@link CatalogItem} object with the specified * <code>code</code>. * * @param code the code of an item. * @return The {@link CatalogItem} object with the specifed * code. Returns <code>null</code> if the object with * the code is not found. */ public CatalogItem getItem(String code) { for (CatalogItem catalogItem : this.items) { if (catalogItem.getCode().equals(code)) { return catalogItem; } } return null; }

Page 38: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

38

Class Catalog

/** * Returns the number of items in the catalog. * * @return the number of {@link CatalogItem} objects in this * catalog */ public int getNumberOfItems() {

return this.items.size(); }}

Page 39: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

39

Class Diagram

Page 40: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

40

Class BorrowerItemsimport java.util.*;import java.text.*;

/** * Maintains a collection of {@link CatalogItems} * assigned to a borrower. * * @author author name * @version 1.0.0 * @see CatalogItem */public class BorrowedItems implements Iterable<CatalogItem> {

/* Catalog items assigned to a borrower.*/ private ArrayList<CatalogItem> items;

Page 41: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

41

Class BorrowerItems

/**

* Sets the collection of {@link CatalogItems} to empty.

*/

public BorrowedItems() {

this.items = new ArrayList<CatalogItem>();

}

Page 42: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

42

Class BorrowerItems

/**

* Adds a {@link CatalogItem} object to this collection and

* sets the {@link CatalogItem} object as not available.

*

* @param item the {@link CatalogItem} object.

*/

public void addItem(CatalogItem catalogItem) {

this.items.add(catalogItem);

catalogItem.setAvailable(false);

}

Page 43: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

43

Class BorrowerItems

/**

* Removes a {@link CatalogItem} object from this collection

* and sets the {@link CatalogItem} object as available.

*

* @param item the {@link CatalogItem} object.

*/

public void removeItem(CatalogItem catalogItem) {

this.items.removeElement(catalogItem);

catalogItem.setAvailable(true);

}

Page 44: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

44

Class BorrowerItems

/**

* Returns an iterator over the borrowed items in this

* collection.

*

* return an {@link Iterator}

*/

public Iterator<CatalogItem> iterator() {

return this.items.iterator();

}

Page 45: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

45

Class BorrowerItems /** * Returns the {@link CatalogItem} object with the specified * <code>code</code>. * * @param code the code of an item. * @return The {@link CatalogItem} object with the specifed * code. Returns <code>null</code> if the object with * the code is not found. */ public CatalogItem getItem(String code) { for (CatalogItem catalogItem : this.items) { if (catalogItem.getCode().equals(code)) { return catalogItem; } } return null; }

Page 46: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

46

Class BorrowerItems

/**

* Returns the number of borrowed items.

*

* @return the number of borrowed items.

*/

public int getNumberOfItems() {

return this.items.size();

}

}

Page 47: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

47

Class Diagram

Page 48: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

48

Class BorrowerDatabaseimport java.util.*;import java.text.*;

/** * Maintains a collection of {@link Borrower} objects. * * @author author name * @version 1.0.0 * @see Borrower */public class BorrowerDatabase implements Iterable<Borrower> {

/* Collection of <code>Borrower</code> objects.*/ private ArrayList<Borrower> borrowers;

Page 49: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

49

Class BorrowerDatabase

/**

* Constructs an empty collection of {@link Borrower}

* objects.

*/

public BorrowerDatabase() {

this.borrowers = new ArrayList<Borrower>(); }

Page 50: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

50

Class BorrowerDatabase

/**

* Adds a {@link Borrower} object to this collection.

*

* @param borrower the {@link Borrower} object.

*/

public void addBorrower(Borrower borrower) {

this.borrowers.add(borrower);

}

Page 51: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

51

Class BorrowerDatabase

/**

* Returns an iterator over the borrowers in this database.

*

* return an {@link Iterator}

*/

public Iterator<Borrower> iterator() {

return this.borrowers.iterator();

}

Page 52: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

52

Class BorrowerDatabase /** * Returns the {@link Borrower} object with the specified * <code>id</code>. * * @param code the id of the borrower. * @return The {@link Borrower} object with the specifed id. * Returns <code>null</code> if the object with the * id is not found. */ public Borrower getBorrower(String id) { for (Borrower borrower : this.borrowers) { if (borrower.getId().equals(id)) { return borrower; } } return null; }

Page 53: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

53

Class BorrowerDatabase

/**

* Returns the number of {@link Borrower} objects in this

* collection.

*

* @return the number of {@link Borrower} objects in this

* collection.

*/

public int getNumberOfBorrowers() {

return this.borrowers.size();

}

}

Page 54: Object-Oriented Design and Programming (Java). 2 Topics Covered Today 2.2 Collections –2.2.1 Arrays –2.2.2 Vectors and Iterators –2.2.3 Implementing the

Collection 类继承关系

54