Collections Lab |
CS 159 CS 159 Docs Labs Projects Labs 01 - Eclipse Lab 02 - Memory Lab 03 - Two-Dimensional Arrays Lab 04 - Debugger Lab 05 - Class Design Lab 06 - ArrayList Lab 07 - File I/O Lab 08 - Unit Testing Lab 09 - Inheritance I/O Lab 13 - Exam 2 Practice Lab 14 - Object-Oriented Design Lab Class Design Tips 15 - Interfaces Lab 16 - Collections Lab 17 - Recursion in CodingBat Lab 18 - Recursive Structures Lab View page source Edit this page Create child page Create documentation issue Print entire section Introduction Submitting Tag Cloud .equals1 .jar1 .toString1 2D-array2 abstract1 accessor1 activation record1 arguments1 array3 arraylist1 checkstyle2 class design1 CLI3 collections1 command line3 constructor1 coverage1 data modeling1 debugger1 design1 docs1 document3 eclipse3 editor3 enum1 exam21 exceptions1 file3 format2 generalization1 gradescope1 heap1 inheritance3 input2 install1 interface1 jacoco1 jdk1 junit5 lab1 load1 memory1 mutator1 object-oriented1 oo1 OOP1 output2 overload1 override2 polymorphism2 project7 project11 project21 project31 project41 project51 project61 read1 recursion3 save1 setup1 stack1 stub1 test2 tutor1 UML1 unit test3 unit testing1 validate1 visualizer1 write1 Categories Docs2 Lab17 Project7 Labs 16 - Collections Lab Collections Lab Tags: collections Categories: Lab less than a minute Introduction Your goal in this lab is to complete the unfinished methods: CollectionExercises.java The Gradescope JUnit tests are provided for your convenience: CollectionExercisesTest.java For each method, you should first take a minute to think about the problem in order to select an appropriate collection type (or types) to use in your solution. The following documentation might be helpful. Collection ArrayList HashSet HashMap Iterator You should take full advantage of the functionality provided by the collection classes to make your solutions as concise and efficient as possible. For example, the Collection interface provides an addAll method that makes it possible to add all of the elements of one collection to another using a single method call. Where appropriate, you should use that method rather than creating a loop that repeatedly calls the add method. Your solutions for these exercises must satisfy the following requirements: You may not use indexed for loops. Use only for-each loops or iterators, as appropriate. None of your methods may include nested loops. Nested loops generally take a long time to iterate over large collections. (You will look at this more formally in CS 240). Submitting Submit your completed file to Gradescope. You may submit as many times as you like. Last modified April 30, 2022: practice coding exam (a2ce8c8) © 2022 The Docsy Authors All Rights Reserved Privacy Policy About Goldydocs