The numbers in the output below were randomly generated. The numbers you get will be different. That's fine.

Return to assignment description

Sample Output

Zero-Arg Constructor -------------------- [].size() == 0 [].isEmpty() == true [].contains(6) == false [].contains(7) == false [].getFrequency(6) == 0 [].getFrequency(7) == 0 ...press enter... Got expected exception [] ...press enter... Added 0 Added 1 Added 2 Added 3 Added 4 Added 5 Added 6 Added 7 Added 8 Added 9 Added 10 Added 11 ...press enter... [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] ...press enter... [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].toArray() == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] Array 'big' before: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].toArray(big) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, null, -1, -1, -1, -1, -1, -1, -1] Array 'big' after: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, null, -1, -1, -1, -1, -1, -1, -1] Array 'small' before: [-1, -1] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].toArray(small) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] Array 'small' after: [-1, -1] ...press enter... [0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11].size() == 13 [0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11].isEmpty() == false [0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11].contains(6) == true [0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11].contains(7) == true [0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11].getFrequency(6) == 2 [0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11].getFrequency(7) == 1 ...press enter... Removed 0 Removed 3 Removed 6 Removed 9 Failed to remove 12 Failed to remove 15 Failed to remove 18 [1, 2, 4, 5, 6, 7, 8, 10, 11] ...press enter... [1, 2, 4, 5, 6, 7, 8, 10, 11].size() == 9 [1, 2, 4, 5, 6, 7, 8, 10, 11].isEmpty() == false [1, 2, 4, 5, 6, 7, 8, 10, 11].contains(6) == true [1, 2, 4, 5, 6, 7, 8, 10, 11].contains(7) == true [1, 2, 4, 5, 6, 7, 8, 10, 11].getFrequency(6) == 1 [1, 2, 4, 5, 6, 7, 8, 10, 11].getFrequency(7) == 1 ...press enter... Removing 1 Removing 2 Removing 4 Removing 5 Removing 6 Removing 7 Removing 8 Removing 10 Removing 11 No more to remove! [] ...press enter... [].size() == 0 [].isEmpty() == true [].contains(6) == false [].contains(7) == false [].getFrequency(6) == 0 [].getFrequency(7) == 0 ...press enter... One-Arg Constructor ------------------- [].size() == 0 [].isEmpty() == true [].contains(6) == false [].contains(7) == false [].getFrequency(6) == 0 [].getFrequency(7) == 0 ...press enter... Got expected exception [] ...press enter... Added 0 Added 1 Added 2 Added 3 Added 4 Added 5 Added 6 Added 7 Added 8 Added 9 Added 10 Added 11 ...press enter... [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] ...press enter... [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0].toArray() == [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] Array 'big' before: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0].toArray(big) == [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, null, -1, -1, -1, -1, -1, -1, -1] Array 'big' after: [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, null, -1, -1, -1, -1, -1, -1, -1] Array 'small' before: [-1, -1] [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0].toArray(small) == [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] Array 'small' after: [-1, -1] ...press enter... [11, 10, 9, 8, 7, 6, 6, 5, 4, 3, 2, 1, 0].size() == 13 [11, 10, 9, 8, 7, 6, 6, 5, 4, 3, 2, 1, 0].isEmpty() == false [11, 10, 9, 8, 7, 6, 6, 5, 4, 3, 2, 1, 0].contains(6) == true [11, 10, 9, 8, 7, 6, 6, 5, 4, 3, 2, 1, 0].contains(7) == true [11, 10, 9, 8, 7, 6, 6, 5, 4, 3, 2, 1, 0].getFrequency(6) == 2 [11, 10, 9, 8, 7, 6, 6, 5, 4, 3, 2, 1, 0].getFrequency(7) == 1 ...press enter... Removed 0 Removed 3 Removed 6 Removed 9 Failed to remove 12 Failed to remove 15 Failed to remove 18 [11, 10, 8, 7, 6, 5, 4, 2, 1] ...press enter... [11, 10, 8, 7, 6, 5, 4, 2, 1].size() == 9 [11, 10, 8, 7, 6, 5, 4, 2, 1].isEmpty() == false [11, 10, 8, 7, 6, 5, 4, 2, 1].contains(6) == true [11, 10, 8, 7, 6, 5, 4, 2, 1].contains(7) == true [11, 10, 8, 7, 6, 5, 4, 2, 1].getFrequency(6) == 1 [11, 10, 8, 7, 6, 5, 4, 2, 1].getFrequency(7) == 1 ...press enter... Removing 11 Removing 10 Removing 8 Removing 7 Removing 6 Removing 5 Removing 4 Removing 2 Removing 1 No more to remove! [] ...press enter... [].size() == 0 [].isEmpty() == true [].contains(6) == false [].contains(7) == false [].getFrequency(6) == 0 [].getFrequency(7) == 0 ...press enter... The All Methods --------------- [be, be, is, not, or, question, that, the, to, to].containsAll([to, be]) == true (should be true) [be, be, is, not, or, question, that, the, to, to].containsAll([can't, be]) == false (should be false) [be, be, is, not, or, question, that, the, to, to].containsAll([nevertheless]) == false (should be false) [be, be, is, not, or, question, that, the, to, to] ...press enter... [be, be, is, not, or, question, that, the, to, to].removeAll([nevertheless]) == false (should be false) [be, be, is, not, or, question, that, the, to, to].removeAll([can't, be]) == true (should be true) [is, not, or, question, that, the, to, to].removeAll([to, be]) == true (should be true) [is, not, or, question, that, the] ...press enter... [is, not, or, question, that, the].retainAll([not, never, that, the, is]) == true (should be true) [is, not, that, the].retainAll([not, never, that, the, is]) == false (should be false) [is, not, that, the] ...press enter... [is, not, that, the].addAll([monotonic, or, logic, or, not]) == true (should be true) [is, logic, monotonic, not, not, or, or, that, the].addAll([]) == false (should be false) [is, logic, monotonic, not, not, or, or, that, the] ...press enter... [is, logic, monotonic, not, not, or, or, that, the].clear() [] ...press enter...

Return to assignment description