CS 240 – Advanced Programming Concepts

Slides:



Advertisements
Similar presentations
Transparency No. 1 Java Collection API : Built-in Data Structures for Java.
Advertisements

Concrete collections in Java library
JAVA Programming (Session 7) When you are willing to make sacrifices for a great cause, you will never be alone. Instructor:
Collections Framework A very brief look at Java’s Collection Framework David Davenport May 2010.
1 L43 Collections (3). 2 OBJECTIVES  To use the collections framework interfaces to program with collections polymorphically.  To use iterators to “walk.
24-Jun-15 Introduction to Collections. 2 Collections A collection is a structured group of objects Java 1.2 introduced the Collections Framework Collections.
Java Collections. Collections, Iterators, Algorithms CollectionsIteratorsAlgorithms.
Java's Collection Framework
Collections. Why collections? Collections are used to hold a collection of objects. List holds objects based on order of insertion and can hold non unique.
SEG4110 – Advanced Software Design and Reengineering TOPIC G Java Collections Framework.
Java Collections Framework A presentation by Eric Fabricant.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 22 Java Collections.
Java™ How to Program, 9/e Presented by: Dr. José M. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
The Java Collections Framework (JCF) Introduction and review 1.
Big Java Chapter 16.
CSS446 Spring 2014 Nan Wang.  Java Collection Framework ◦ Set ◦ Map 2.
Some Other Collections: Bags, Sets, Queues and Maps COMP T2 Lecture 4 School of Engineering and Computer Science, Victoria University of Wellington.
HIT2037- HIT6037 Software Development in Java 22 – Data Structures and Introduction.
Data structures and algorithms in the collection framework 1.
Arrays, ArrayLists, and Collections. Rationale Suppose we have a program to compute the average of three numbers. We could write a simple little method.
Week 3 - Friday.  What did we talk about last time?  Stacks  Array implementation of a stack.
Collections Data structures in Java. OBJECTIVE “ WHEN TO USE WHICH DATA STRUCTURE ” D e b u g.
Collections Mrs. C. Furman April 21, Collection Classes ArrayList and LinkedList implements List HashSet implements Set TreeSet implements SortedSet.
Priority Queues. Priority Queue ADT A priority queue stores a collection of entries Each entry is a pair (key, value) Main methods of the Priority Queue.
1 Java's Collection Framework Map and Sets. 2 Collection Framework  A collections framework is a unified architecture for representing and manipulating.
CS Fall 2012, Lab 04 Haohan Zhu. Boston University Slideshow Title Goes Here CS Fall 2012, Lab /29/2016 Changes of Office Hours  Monday.
Object Oriented Programming and Data Abstraction Rowan University Earl Huff.
CS-2851 Dr. Mark L. Hornick 1 Stacks and Queues Behavior vs. Structure.
3-1 Java's Collection Framework Another use of polymorphism and interfaces Rick Mercer.
©Karsten Lundqvist Example: Array and Arrays 1 import java.util.*; public class Example { private int intValues[] = { 1, 2, 3, 4, 5, 6 }; private double.
COMP2402 The Java Collections Framework II: Implementations and Algorithms Pat Morin.
Slides by Donald W. Smith
Java Collections OOP tirgul No
Using the Java Collection Libraries COMP 103 # T2
Week 4 - Monday CS221.
G64ADS Advanced Data Structures
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.
Marcus Biel, Software Craftsman
Some Collections: BAGS, SETS, and STACKS
Chapter 19 Java Data Structures
Wednesday Notecards. Wednesday Notecards Wednesday Notecards.
JAVA COLLECTIONS LIBRARY
University of Central Florida COP 3330 Object Oriented Programming
CSE 373: Data Structures and Algorithms
CS240: Advanced Programming Concepts
Week 2: 10/1-10/5 Monday Tuesday Wednesday Thursday Friday
Road Map CS Concepts Data Structures Java Language Java Collections
Road Map CS Concepts Data Structures Java Language Java Collections
structures and their relationships." - Linus Torvalds
Road Map - Quarter CS Concepts Data Structures Java Language
structures and their relationships." - Linus Torvalds
Data Structures and Algorithms
Môn: Lập trình Hướng đối tượng (Object Oriented Programming)
14.1 The java.util Package.
Implementing Hash and AVL
Welcome to CSE 143! Go to pollev.com/cse143.
Exercise Write a program that counts the number of unique words in a large text file (say, Moby Dick or the King James Bible). Store the words in a collection.
Collections Framework
CSE 373 Java Collection Framework, Part 2: Priority Queue, Map
CSE 1020: The Collection Framework
Road Map CS Concepts Data Structures Java Language Java Collections
slides created by Marty Stepp
Trees in java.util A set is an object that stores unique elements
Queues cont. Chapter 8 © 2011 Pearson Addison-Wesley. All rights reserved.
CSE 373 Java Collection Framework reading: Weiss Ch. 3, 4.8
structures and their relationships." - Linus Torvalds
Chengyu Sun California State University, Los Angeles
Abstract Data Types (ADTs)
Presentation transcript:

CS 240 – Advanced Programming Concepts Java Collections CS 240 – Advanced Programming Concepts

Java Collections Collection, Iterator, Algorithms (Collections Class)

List List interface A sequence of elements accessed by index get(index), set(index, value) ArrayList (resizable array implementation) LinkedList (doubly-linked list implementation)

Set Set interface A collection that contains no duplicates add(value), contains(value), remove(value) HashSet (hash table implementation) TreeSet (bst implementation) LinkedHashSet (hash table + linked list impl)

Queue Queue interface A collection designed for holding elements prior to processing add(value), peek(), remove() ArrayDeque (fifo, resizable array impl) LinkedList (fifo, linked list implementation) PriorityQueue (priority queue, binary heap impl)

Deque Deque interface A queue that supports efficient insertion and removal at both ends addFirst(value), addLast(value), peekFirst(), peekLast(), removeFirst(), removeLast() ArrayDeque (resizable array implementation) LinkedList (linked list implementation)

Stack Java’s Stack class is deprecated If you need a stack, use a Deque push() => Deque.addFirst() pop() => Deque.removeFirst() peek() => Deque.peekFirst()

Map Map interface A collection that maps keys to values A set of (key, value) pairs where keys are unique put(key, value), get(key), contains(key), remove(key) keySet(), values(), entrySet() HashMap (hash table implementation) TreeMap (bst implementation) LinkedHashMap (hash table + linked list impl)