Download presentation
Presentation is loading. Please wait.
1
Review Question 10.2 List<E> Set<E> Map<K,V>
What are the three main interfaces in the collection framework? List<E> Set<E> Map<K,V>
2
Review Question 10.3 Name the classes that implement each interface, and state which is used when
3
Review Question 10.4 Why do we specify a type when creating a collection? Why not leave it Object?
4
Review Question 10.5 Consider the types List<CreditCard> List<RewardCard> Is it true that one of them extends the other?
5
Review Question 10.6 A method takes as its parameter Set<? extends CreditCard> Can we pass to it a Set<RewardCard> ?
6
Exercise 10.1 Determine the interface that should be used for each of the following collections The names of all students registered in a course The letter grades obtained in a course The names of your contacts and the telephone number of each The reserved words in Java
7
Exercise 10.2 Identify the compile-time error List<int> = new LinkedList<int>; Set<Date> = new HashMap<Date>; Map<String> = new TreeMap<String>;
8
Exercise 10.3 Write a program that deletes all but the last element from a given list
9
Exercise 10.4 Write a program that displays every other element of a given set
10
Exercise 10.11 Write a program that sorts a given set
11
Exercise 10.12 Write a program that reads a filename from the user and determines if it contains a serialization of Map<Integer,Date> If it does, determine and output the earliest date
12
Exercise 10.5 Write a program that determines the largest key in a given map. Assume that the key type K satisfies K extends Comparable<? super K>
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.