Review Question 10.2 List<E> Set<E> Map<K,V>

Slides:



Advertisements
Similar presentations
Collections Chapter Java Collection Frameworks The Java collection framework is a set of utility classes and interfaces. Designed for working with.
Advertisements

Computer Science 209 Software Development Equality and Comparisons.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
1 L43 Collections (3). 2 OBJECTIVES  To use the collections framework interfaces to program with collections polymorphically.  To use iterators to “walk.
Slides prepared by Rose Williams, Binghamton University Chapter 13 Interfaces and Inner Classes.
CS102--Object Oriented Programming Discussion 1: – Project 4 on Page 328 – The use of arrays Copyright © 2008 Xiaoyan Li.
1 L42 Collections (2). 2 OBJECTIVES  To use collections framework algorithms to manipulate  search  sort  and fill collections.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L15 (Chapter 22) Java Collections.
Slides prepared by Rose Williams, Binghamton University Chapter 16 Collections and Iterators.
Chapter 10 2D Arrays Collection Classes. Topics Arrays with more than one dimension Java Collections API ArrayList Map.
Chapter 19 Java Data Structures
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 22 Lists, Stacks, Queues, and Priority.
Computer Science 209 The Strategy Pattern II: Emulating Higher-Order Functions.
Lists and More About Strings CS303E: Elements of Computers and Programming.
INTRODUCTION TO EMBEDDED SYSTEMS INTERFACING TO THE FREESCALE 9S12 Power Point Presentation Local Variables and Parameter Passing 8-1.
Chapter 11 Inheritance and Composition. Chapter Objectives Learn about inheritance Learn about subclasses and superclasses Explore how to override the.
An analysis of exam results in the Object-Oriented Programming course at „Politehnica” University of Timisoara Ioan Jurca.
ARRAYLIST.. Hazen High School. Vocabulary to Know ArrayList Generic Class ArrayList Operations ArrayList Methods ArrayList Searching For-Each Wrapper.
CSC 243 – Java Programming, Spring 2013 March 12, 2013 Week 7, Generics.
The Java Collections Framework (Part 2) By the end of this lecture you should be able to: Use the HashMap class to store objects in a map; Create objects.
Objectives - 11  We will work with processing Arrays.  Objectives:  Describe the concept of an array and its benefits.  Define the terms index, traverse,
Data Structures Using Java1 Chapter 2 Inheritance and Exception Handling.
Review Class Inheritance, Abstract, Interfaces, Polymorphism, GUI (MVC)
Difficult Specifications in Javari Immutability Inference Jaime Quinonez Program Analysis Group April 20, 2007.
Polymorphism (generics) CSE 331 University of Washington.
Java Programming: From Problem Analysis to Program Design, 3e Chapter 11 Inheritance and Polymorphism.
Interfaces and Inner Classes
Object-Oriented Analysis and Design Use cases Finding classes Collaboration and Sequence diagrams Associations between classes.
Maps Nick Mouriski.
Slides prepared by Rose Williams, Binghamton University Chapter 16 Collections and Iterators.
CMSC 202 Containers and Iterators. Container Definition A “container” is a data structure whose purpose is to hold objects. Most languages support several.
Defining Classes I Part B. Information hiding & encapsulation separate how to use the class from the implementation details separate how to use the class.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
CSE 1020: Exceptions and A multiclass application Mark Shtern 1-1.
Java Collection Classes Com379PT
Chapter 5 Arrays F Introducing Arrays F Declaring Array Variables, Creating Arrays, and Initializing Arrays F Passing Arrays to Methods F Copying Arrays.
1 Project 12: Cars from File. This is an extension of Project 11, Car Class You may use the posted solution for Project 11 as a starting point for this.
Chapter 21 Sets and Maps Jung Soo (Sue) Lim Cal State LA.
Set Collection A Bag is a general collection class that implements the Collection interface. A Set is a collection that resembles a Bag with the provision.
CSE 143 Lecture 20 Binary Search Trees continued; Tree Sets
CSC 243 – Java Programming, Spring 2014
Chapter 19 Java Data Structures
Software Development Java Collections
Chapter 11: Inheritance and Polymorphism
More on Java Generics Multiple Generic Types Bounded Generic Types
A tree set Our SearchTree class is essentially a set.
Road Map CS Concepts Data Structures Java Language Java Collections
For Monday Read WebCT quiz 18.
Chapter 12 Collections.
CSE 373: Data Structures and Algorithms
Teach A level Computing: Algorithms and Data Structures
Java Collections Framework
Chapter 5 Arrays Introducing Arrays
A tree set Our SearchTree class is essentially a set.
Practical Session 4 Java Collections
Object-Oriented Programming Paradigm
CSE 1030: The Collection Frameworks
CSE 1020:Inheritance Mark Shtern.
Collections Not in our text.
Exercise 1 Modify some parameters in the histogram.js and see what would happen (one by one) 20 in Line 2  in Line 3  in Line 15  .9.
Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract, Computer,
Programming Languages
L5. Necessary Java Programming Techniques
CSE 1020: The Collection Framework
Containers and Iterators
Chapter 12 Collections.
1.4 ทบทวน JAVA OO Programming Concepts Declaring and Creating Objects
AP Computer Science DYRT Quiz
Chapter 19 Searching, Sorting and Big O
Unions.
Presentation transcript:

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>

Review Question 10.3 Name the classes that implement each interface, and state which is used when

Review Question 10.4 Why do we specify a type when creating a collection? Why not leave it Object?

Review Question 10.5 Consider the types List<CreditCard> List<RewardCard> Is it true that one of them extends the other?

Review Question 10.6 A method takes as its parameter Set<? extends CreditCard> Can we pass to it a Set<RewardCard> ?

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

Exercise 10.2 Identify the compile-time error List<int> = new LinkedList<int>; Set<Date> = new HashMap<Date>; Map<String> = new TreeMap<String>;

Exercise 10.3 Write a program that deletes all but the last element from a given list

Exercise 10.4 Write a program that displays every other element of a given set

Exercise 10.11 Write a program that sorts a given set

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

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>