1 00:00:00,550 --> 00:00:05,710 And this solution, we're going to quality control the manager class, almost every bad invocation of 2 00:00:05,710 --> 00:00:10,780 a method or constructor is because the caller passed an illegal arguments or called the method that 3 00:00:10,780 --> 00:00:11,410 about time. 4 00:00:15,470 --> 00:00:20,090 So looking at the code, I can't think of any illegal arguments the user may pass that haven't been 5 00:00:20,090 --> 00:00:23,900 accounted for because the constructor doesn't receive any parameters. 6 00:00:23,900 --> 00:00:26,210 So there's nothing to really check and hear. 7 00:00:26,210 --> 00:00:31,820 If the user passes a null instead of an actual object, the code would already throw a null pointer 8 00:00:31,820 --> 00:00:32,390 exception. 9 00:00:32,659 --> 00:00:35,770 So throwing in a legal argument exception would be redundant. 10 00:00:36,590 --> 00:00:40,130 The same argument can be made for ad contact and remove contact. 11 00:00:44,310 --> 00:00:46,300 What about illegal state exceptions? 12 00:00:46,830 --> 00:00:51,180 Remember that illegal exceptions occur when an object calls its method at a bad time. 13 00:00:51,690 --> 00:00:53,000 What about ad contact? 14 00:00:53,610 --> 00:00:58,250 If there was a maximum number of contacts that you can store, then you could throw an illegal state 15 00:00:58,260 --> 00:01:00,420 exception for that particular scenario. 16 00:01:00,780 --> 00:01:05,340 But if you were to go back and read the requirements, there is no limit to the number of contacts that 17 00:01:05,340 --> 00:01:05,880 you can add. 18 00:01:07,810 --> 00:01:13,210 Although an object would not be in a valid state to call or remove contact if the Israelis, it is empty, 19 00:01:13,630 --> 00:01:20,020 if there are no contacts to remove now, array lists have an empty method that returns true if it has 20 00:01:20,020 --> 00:01:20,800 no elements. 21 00:01:26,950 --> 00:01:28,840 So we'll check if contact. 22 00:01:31,300 --> 00:01:32,230 That is empty. 23 00:01:35,070 --> 00:01:37,950 And in such a case will throw a new illegal -- exception. 24 00:01:41,330 --> 00:01:44,600 You can't call the remove method if there are no contacts to remove. 25 00:01:50,360 --> 00:01:55,220 OK, I can't think of any more safety checks that we need to apply so we can wrap up right here.