1 00:00:00,000 --> 00:00:02,410 [No Audio] 2 00:00:02,410 --> 00:00:04,003 So, getting back to the code we were looking 3 00:00:04,003 --> 00:00:06,243 at before we configured the Maven compiler plugin, 4 00:00:06,243 --> 00:00:09,047 let's just do a quick bit of tidy up. 5 00:00:09,047 --> 00:00:11,134 Let's just say we do a stream 6 00:00:11,134 --> 00:00:16,294 here, then a filter and then .collect. 7 00:00:16,294 --> 00:00:18,694 To me that's more kind of readable here as a best 8 00:00:18,694 --> 00:00:21,160 practice because we end up with this is the method 9 00:00:21,160 --> 00:00:24,060 which has been executed in the data layer 10 00:00:24,060 --> 00:00:25,910 to get all the users. 11 00:00:25,910 --> 00:00:28,306 This is telling us that we're using the Java Extremes 12 00:00:28,306 --> 00:00:31,558 API to do some slicing and dicing of data. 13 00:00:31,558 --> 00:00:35,591 Then basically we have each intermediate operation 14 00:00:35,591 --> 00:00:38,191 underneath that on its online so that we can very 15 00:00:38,191 --> 00:00:40,678 clearly see how that pipeline has been executed. 16 00:00:40,678 --> 00:00:42,522 In this case it's just doing a filter operation to 17 00:00:42,536 --> 00:00:45,694 say filter out users that are live REGULAR_USERS. 18 00:00:45,694 --> 00:00:47,434 And then finally we have the terminal operation 19 00:00:47,434 --> 00:00:49,184 which in this case is a collect, to 20 00:00:49,184 --> 00:00:51,596 collect those elements into a set. 21 00:00:51,596 --> 00:00:52,904 So when this method here is 22 00:00:52,904 --> 00:00:54,658 executed, just get rid of RegularUsers. 23 00:00:54,658 --> 00:00:56,507 Expect that we get a set containing 24 00:00:56,507 --> 00:00:58,899 [No Audio] 25 00:00:58,899 --> 00:01:01,906 these three users here because they're RegularUsers. 26 00:01:01,906 --> 00:01:02,905 As we can see, 27 00:01:02,905 --> 00:01:05,580 [No Audio] 28 00:01:05,580 --> 00:01:09,250 now let's do a similar thing for the AdminUsers. 29 00:01:09,250 --> 00:01:14,830 [No Audio] 30 00:01:14,830 --> 00:01:17,836 So getAdminUsers same kind of 31 00:01:17,836 --> 00:01:21,939 thing, it's just this ADMIN_USER. 32 00:01:21,939 --> 00:01:24,722 So that's nice from a functional perspective since 33 00:01:24,722 --> 00:01:27,255 we've now got two methods to be able to return a 34 00:01:27,255 --> 00:01:29,596 different types of users that we have in the system. 35 00:01:29,596 --> 00:01:30,892 But we can go further with this 36 00:01:30,892 --> 00:01:32,310 which we'll do in the next videos.