Bài giảng Cấu trúc dữ liệu: Chương 14 - Nguyễn Xuân Vinh
Số trang: 22
Loại file: pptx
Dung lượng: 379.35 KB
Lượt xem: 8
Lượt tải: 0
Xem trước 3 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Bài giảng Cấu trúc dữ liệu - Chương 14: Conllectinons framework introduction to collections, what is a collections framework, collections interface, collections implementations, collections comparision,...
Nội dung trích xuất từ tài liệu:
Bài giảng Cấu trúc dữ liệu: Chương 14 - Nguyễn Xuân VinhGV: NGUYỄN XUÂN VINH CẤU TRÚC DỮ LIỆU DATA STRUCTURES [214441] COLLECTIONs FRAMEWORKMÔN: CẤU TRÚC DỮ LIỆU Nguyễn Xuân Vinh nguyenxuanvinh@hcmuaf.edu.6/12/14 vn/XX1GV: NGUYỄN XUÂN VINH Introduction to Collections • Acollection—sometimescalledacontainer—issimplyanobject thatgroupsmultipleelementsintoasingleunit. • Collectionsareusedtostore,retrieve,manipulate,and communicateaggregatedata. • Representdataitemsthatformanaturalgroup,suchas:MÔN: CẤU TRÚC DỮ LIỆU – Apokerhand(acollectionofcards) – Amailfolder(acollectionofletters) – Atelephonedirectory(amappingofnamestophonenumbers)6/12/14/XX2GV: NGUYỄN XUÂN VINH What is a Collections Framework • Acollections frameworkisaunifiedarchitectureforrepresenting andmanipulatingcollections. • Allcollectionsframeworkscontainthefollowing: – Interfaces:Theseareabstractdatatypesthatrepresent collectionsMÔN: CẤU TRÚC DỮ LIỆU – Implementations:Thesearetheconcreteimplementationsof thecollectioninterfaces. – Algorithms:Thesearethemethodsthatperformuseful computations,suchassearchingandsorting6/12/14/XX34 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Collections Interface5 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Collections Implementations6 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Collections Implementations7 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Collection Implementations8 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Concrete Classes: Collection9 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Concrete Class: MAP10 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Collections ComparisionGV: NGUYỄN XUÂN VINH 1) Collection Interface:Traversing Collections • Therearetwowaystotraversecollections: – (1)withthefor-eachconstruct for (Object o : collection) System.out.println(o);MÔN: CẤU TRÚC DỮ LIỆU – (2)byusingIterators. Iterator iterator = collection.iterator(); while(iterator.hasNext()) { System.out.println(iterator.next()); }6/12/14/XX11GV: NGUYỄN XUÂN VINH 2) Collection Interface: Bulk Operations • containsAll—returnstrueifthetargetCollectioncontainsallof theelementsinthespecifiedCollection. • addAll—addsalloftheelementsinthespecifiedCollectiontothe targetCollection. • removeAll—removesfromthetargetCollectionallofitselementsMÔN: CẤU TRÚC DỮ LIỆU thatarealsocontainedinthespecifiedCollection. • retainAll—removesfromthetargetCollectionallitselementsthat ...
Nội dung trích xuất từ tài liệu:
Bài giảng Cấu trúc dữ liệu: Chương 14 - Nguyễn Xuân VinhGV: NGUYỄN XUÂN VINH CẤU TRÚC DỮ LIỆU DATA STRUCTURES [214441] COLLECTIONs FRAMEWORKMÔN: CẤU TRÚC DỮ LIỆU Nguyễn Xuân Vinh nguyenxuanvinh@hcmuaf.edu.6/12/14 vn/XX1GV: NGUYỄN XUÂN VINH Introduction to Collections • Acollection—sometimescalledacontainer—issimplyanobject thatgroupsmultipleelementsintoasingleunit. • Collectionsareusedtostore,retrieve,manipulate,and communicateaggregatedata. • Representdataitemsthatformanaturalgroup,suchas:MÔN: CẤU TRÚC DỮ LIỆU – Apokerhand(acollectionofcards) – Amailfolder(acollectionofletters) – Atelephonedirectory(amappingofnamestophonenumbers)6/12/14/XX2GV: NGUYỄN XUÂN VINH What is a Collections Framework • Acollections frameworkisaunifiedarchitectureforrepresenting andmanipulatingcollections. • Allcollectionsframeworkscontainthefollowing: – Interfaces:Theseareabstractdatatypesthatrepresent collectionsMÔN: CẤU TRÚC DỮ LIỆU – Implementations:Thesearetheconcreteimplementationsof thecollectioninterfaces. – Algorithms:Thesearethemethodsthatperformuseful computations,suchassearchingandsorting6/12/14/XX34 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Collections Interface5 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Collections Implementations6 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Collections Implementations7 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Collection Implementations8 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Concrete Classes: Collection9 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Concrete Class: MAP10 /XX 6/12/14 MÔN: CẤU TRÚC DỮ LIỆU GV: NGUYỄN XUÂN VINH Collections ComparisionGV: NGUYỄN XUÂN VINH 1) Collection Interface:Traversing Collections • Therearetwowaystotraversecollections: – (1)withthefor-eachconstruct for (Object o : collection) System.out.println(o);MÔN: CẤU TRÚC DỮ LIỆU – (2)byusingIterators. Iterator iterator = collection.iterator(); while(iterator.hasNext()) { System.out.println(iterator.next()); }6/12/14/XX11GV: NGUYỄN XUÂN VINH 2) Collection Interface: Bulk Operations • containsAll—returnstrueifthetargetCollectioncontainsallof theelementsinthespecifiedCollection. • addAll—addsalloftheelementsinthespecifiedCollectiontothe targetCollection. • removeAll—removesfromthetargetCollectionallofitselementsMÔN: CẤU TRÚC DỮ LIỆU thatarealsocontainedinthespecifiedCollection. • retainAll—removesfromthetargetCollectionallitselementsthat ...
Tìm kiếm theo từ khóa liên quan:
Cấu trúc dữ liệu Bài giảng Cấu trúc dữ liệu Cấu trúc dữ liệu Chương 14 Introduction to collections What is a collections framework Giới thiệu về collectionsTài liệu liên quan:
-
Đề cương chi tiết học phần Cấu trúc dữ liệu và giải thuật (Data structures and algorithms)
10 trang 322 0 0 -
Giải thuật và cấu trúc dữ liệu
305 trang 165 0 0 -
Bài giảng Phân tích thiết kế phần mềm: Chương 1 - Trường ĐH Ngoại ngữ - Tin học TP.HCM
64 trang 154 0 0 -
Tập bài giảng Thực hành kỹ thuật lập trình
303 trang 143 0 0 -
Giáo trình Cấu trúc dữ liệu và thuật toán (Tái bản): Phần 1
152 trang 140 0 0 -
Tài liệu tham khảo: Cấu trúc dữ liệu và giải thuật
229 trang 127 0 0 -
Lập trình C - Cấu trúc dữ Liệu
307 trang 76 0 0 -
Ứng dụng và cài đặt cấu trúc dữ liệu bằng C: Phần 1
338 trang 76 0 0 -
Bài giảng Cấu trúc dữ liệu và thuật toán: Chương 3 - Một số mô hình thuật toán
42 trang 74 0 0 -
49 trang 73 0 0