tailieunhanh - Collections framework
Introduction, collection,object ordering sort algorithm in collection, summary,.is the main content of the lecture "Collections framework". Invite you to consult the detailed content lectures to capture details. | COLLECTIONS FRAMEWORK Cam Luu Vi CONTENT Introduction Collection Set List Queue Deque Object Ordering (sort algorithm in collection) Summary INTRODUCTION A collection — 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. INTRODUCTION A collections framework is a unified architecture for representing and manipulating collections. All collections frameworks contain the following: Interfaces Implementations Algorithms INTRODUCTION Benefits: Reduces programming effort Increases program speed and quality Reduces effort to design new APIs CORE COLLECTION INTERFACES The core collection interfaces encapsulate different types of collections, which are Set, List, Queue, Deque CORE COLLECTION INTERFACES COLLECTION A collection represents a group of objects known as its elements A collection of people An element of collection COLLECTION To declare a collection, we need import library Declare a collection: import ; Collection c; COLLECTION Some basic operation methods of collection: int size() boolean isEmpty() boolean contains(Object element) boolean add(E element) boolean remove(Object element) Iterator iterator() COLLECTION Some methods that operate on entire collections: boolean containsAll(Collection c) boolean addAll(Collection c) boolean removeAll(Collection c) boolean retainAll(Collection c) void clear() COLLECTION Traversing Collections: 3 ways to traverse collection Aggregate Operations (JDK 8 or later) For – each Iterator COLLECTION Aggregate Operations: JDK 8 or higher List stu = new ArrayList(); Consumer e = new Consumer() { @Override public void accept(Student arg0) { //Print out to screen (arg0); } }; ().forEach(e); //there is aggregate operation to print student List COLLECTION | COLLECTIONS FRAMEWORK Cam Luu Vi CONTENT Introduction Collection Set List Queue Deque Object Ordering (sort algorithm in collection) Summary INTRODUCTION A collection — 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. INTRODUCTION A collections framework is a unified architecture for representing and manipulating collections. All collections frameworks contain the following: Interfaces Implementations Algorithms INTRODUCTION Benefits: Reduces programming effort Increases program speed and quality Reduces effort to design new APIs CORE COLLECTION INTERFACES The core collection interfaces encapsulate different types of collections, which are Set, List, Queue, Deque CORE COLLECTION INTERFACES COLLECTION A collection represents a group of objects known as its elements A collection of people An element of collection COLLECTION To .
đang nạp các trang xem trước