Tổng hợp kiến thức về Streams (MT2 Review) - Ching and Christines
- ページ数
- 15
- 形式
- サイズ
- 1.2 MB
- 言語
- EN · English
- 年
- 2016
- Trường
- University of California, Berkeley
- 閲覧数
- 0
- コメント
- 0
- Lượt tải
- 0
プレビューを生成中...
Tài liệu ôn tập giữa kỳ 2 môn CS61BL mùa hè 2016, bao gồm tổng hợp kiến thức về Streams, Higher-Order Functions, Lambda, Interfaces, Abstract Classes, Iterators, Generics và các bài tập thực hành.
- ドキュメント名
- Tổng hợp kiến thức về Streams (MT2 Review) - Ching and Christines
- 学校 / コース
- University of California, Berkeley · Lập trình Java
- 内容
- Tài liệu ôn tập cho bài kiểm tra giữa kỳ 2 môn CS61BL, bao gồm lý thuyết về Streams, Higher Order Functions, Lambda, Interfaces, Generics và các bài tập thực hành.
- 目次
- Midterm 2 Review
- Streams
- Intermediate Operations to Know
- Terminal Operations to Know
- Practice Problems
- Higher Order Functions
- Lambda Functions
- Interfaces and Abstract Classes
- Iterators/Generics
- ページ数
- 15 ページ
- アップロード者
- Uni24h
説明
Trích nội dung tài liệu
Midterm 2 Review Note: There are many tricky problems in CS61BL Summer 2016 Midterm 2! Streams Intermediate Operations to Know 1. stream(): Converts a collection into a stream 2. sorted(Comparator c): Sorts the stream using c, which can also be a lambda 3. map(Function f)(): Applies f to each element in the stream 4. filter(Predicate p): Tests each element with p to see if it should remain in the stream Terminal Operations to Know 1. reduce(BinaryOperator accumulator): Applies the accumulator and combines the elements in the stream, two at a time. Returns an Optional. 2. collect(Collector c): Turns the stream into a collection. To a List: Collectors.toList() To a Set: Collectors.toSet() To a Map: Collectors.grooupingBy(Function f) 3. forEach(Consumer action) Practice Problems Given the following classes, write methods to perform the desired operations. You may only use one semicolon per method. public class Student { public int getLabSection() { ... } public int getAge() {...} public Group getGroup {...} } public class Group { public int size() {...} public Group merge(Group other) { ... } } 1 1. Collect all the unique lab sections from a list of students. There should not be duplicates. public Collection<Integer> uniqueSections(List<Student> lst) { } 2. Each TA submits a list of their students. Write a method that will map each lab section to the students in that section whose group is larger than size 4. Assume there is always at least one student in each section whose group size is larger than 4. public Map<Integer, List<Student>> grpMap(List<List<Student>> lst) { } 3. Each TA submits a list of their students. Write a method that will get the number of students who are over age 20. public int over20 (List<List<Student>> lst) { } 4. Each TA submits a list of the groups in their section. Write a method that will keep only the sections with less than 4 groups in them. Then, merge all the groups in a section into one supergroup. If some section has
よくある質問
このドキュメントは無料ですか?
はい。「Tổng hợp kiến thức về Streams (MT2 Review) - Ching and Christines」は無料です。ログインして「ダウンロード」をクリックするだけで、元のファイルを取得できます。
このドキュメントは何ページありますか?
このドキュメントは 15 ページあります(Lập trình Java コース用)。ダウンロードする前にオンラインでプレビューできます。
ダウンロードする前にプレビューできますか?
はい。このページにあるオンラインリーダーでドキュメントをプレビューし、その後ダウンロードするかどうかを決めることができます。
Tổng hợp kiến thức về Streams (MT2 Review) - Ching and Christines
プレビューを生成中...
Trích nội dung tài liệu
Midterm 2 Review Note: There are many tricky problems in CS61BL Summer 2016 Midterm 2! Streams Intermediate Operations to Know 1. stream(): Converts a collection into a stream 2. sorted(Comparator c): Sorts the stream using c, which can also be a lambda 3. map(Function f)(): Applies f to each element in the stream 4. filter(Predicate p): Tests each element with p to see if it should remain in the stream Terminal Operations to Know 1. reduce(BinaryOperator accumulator): Applies the accumulator and combines the elements in the stream, two at a time. Returns an Optional. 2. collect(Collector c): Turns the stream into a collection. To a List: Collectors.toList() To a Set: Collectors.toSet() To a Map: Collectors.grooupingBy(Function f) 3. forEach(Consumer action) Practice Problems Given the following classes, write methods to perform the desired operations. You may only use one semicolon per method. public class Student { public int getLabSection() { ... } public int getAge() {...} public Group getGroup {...} } public class Group { public int size() {...} public Group merge(Group other) { ... } } 1 1. Collect all the unique lab sections from a list of students. There should not be duplicates. public Collection<Integer> uniqueSections(List<Student> lst) { } 2. Each TA submits a list of their students. Write a method that will map each lab section to the students in that section whose group is larger than size 4. Assume there is always at least one student in each section whose group size is larger than 4. public Map<Integer, List<Student>> grpMap(List<List<Student>> lst) { } 3. Each TA submits a list of their students. Write a method that will get the number of students who are over age 20. public int over20 (List<List<Student>> lst) { } 4. Each TA submits a list of the groups in their section. Write a method that will keep only the sections with less than 4 groups in them. Then, merge all the groups in a section into one supergroup. If some section has
- ドキュメント名
- Tổng hợp kiến thức về Streams (MT2 Review) - Ching and Christines
- 学校 / コース
- University of California, Berkeley · Lập trình Java
- 内容
- Tài liệu ôn tập cho bài kiểm tra giữa kỳ 2 môn CS61BL, bao gồm lý thuyết về Streams, Higher Order Functions, Lambda, Interfaces, Generics và các bài tập thực hành.
- 目次
- Midterm 2 Review
- Streams
- Intermediate Operations to Know
- Terminal Operations to Know
- Practice Problems
- Higher Order Functions
- Lambda Functions
- Interfaces and Abstract Classes
- Iterators/Generics
- ページ数
- 15 ページ
- アップロード者
- Uni24h
コメント (0)
まだコメントはありません。最初のコメントを書きましょう!
Ôn tập lập trình Java (MT2 Review Solutions) - Ching and Christines
Asymptotics II, Search Trees (Discussion 7) (Kỹ thuật phân tích thời gian chạy, cây tìm kiếm nhị phân) - Christine Zhou
Introduction to Java (Discussion 1) (Giới thiệu về Java) - Christine Zhou
More Sorting (Discussion 13) (Thuật toán sắp xếp nâng cao) - Christine Zhou
Giáo trình Lập trình Java
Tổng hợp Đề Toán 5 - Luyện thi vào Lớp 6 - CLB EMath
Bài giảng vật lý đại cương (Chương 3) - Đỗ Ngọc Uấn
Chương 8.Nguyên tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 7.Cơ học lượng tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 6.Quang học lượng tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang

コメント (0)
まだコメントはありません。最初のコメントを書きましょう!