WEBVTT

1
00:00:04.260 --> 00:00:05.400
<00:00:04.260>Our <00:00:04.602>agenda <00:00:04.944>for <00:00:05.286>today,

2
00:00:05.450 --> 00:00:10.040
<00:00:05.450>we're <00:00:05.557>gonna <00:00:05.665>look <00:00:05.773>at <00:00:05.880>four <00:00:05.988>items <00:00:06.096>if <00:00:06.203>we <00:00:06.311>got <00:00:06.419>enough <00:00:06.526>time <00:00:06.634>records, <00:00:06.742>sealed, <00:00:06.850>classes,

3
00:00:10.150 --> 00:00:14.680
<00:00:10.150>pattern <00:00:10.277>meshing, <00:00:10.404>because <00:00:10.531>each <00:00:10.659>of <00:00:10.786>them, <00:00:10.913>they're <00:00:11.040>really, <00:00:11.168>really <00:00:11.295>cool <00:00:11.422>by <00:00:11.550>itself.

4
00:00:15.140 --> 00:00:18.880
<00:00:15.140>And <00:00:15.340>using <00:00:15.540>them <00:00:15.740>in <00:00:15.940>conjunction, <00:00:16.140>they're <00:00:16.340>really <00:00:16.540>powerful.

5
00:00:19.550 --> 00:00:22.760
<00:00:19.550>Then <00:00:19.650>of <00:00:19.750>course <00:00:19.850>we're <00:00:19.950>gonna <00:00:20.050>look <00:00:20.150>at <00:00:20.250>a <00:00:20.350>new <00:00:20.450>big <00:00:20.550>thing <00:00:20.650>from <00:00:20.750>Java <00:00:20.850>for <00:00:20.950>21,

6
00:00:23.000 --> 00:00:26.840
<00:00:23.000>virtual <00:00:23.175>threats <00:00:23.350>and <00:00:23.525>some <00:00:23.700>other <00:00:23.875>things <00:00:24.050>from <00:00:24.225>Project <00:00:24.400>Loom.

7
00:00:27.470 --> 00:00:31.760
<00:00:27.470>Then <00:00:27.570>we're <00:00:27.669>gonna <00:00:27.770>see <00:00:27.869>like <00:00:27.970>all <00:00:28.070>the <00:00:28.169>other <00:00:28.270>fancy <00:00:28.369>language <00:00:28.470>things <00:00:28.570>which <00:00:28.669>come <00:00:28.770>in <00:00:28.869>Java

8
00:00:31.760 --> 00:00:34.320
<00:00:31.760>21, <00:00:31.960>which <00:00:32.160>is <00:00:32.360>gonna <00:00:32.560>be <00:00:32.759>released <00:00:32.960>in <00:00:33.160>September.

9
00:00:35.500 --> 00:00:39.480
<00:00:35.500>And <00:00:35.593>then <00:00:35.686>we're <00:00:35.780>gonna <00:00:35.873>look <00:00:35.966>at <00:00:36.060>some <00:00:36.153>examples <00:00:36.246>of <00:00:36.340>modern <00:00:36.433>Java <00:00:36.526>where <00:00:36.620>we <00:00:36.713>use <00:00:36.806>all <00:00:36.900>these

10
00:00:39.530 --> 00:00:42.080
<00:00:39.530>fancy <00:00:39.996>language <00:00:40.463>features <00:00:40.930>together,

11
00:00:43.800 --> 00:00:45.590
<00:00:43.800>right <00:00:44.266>records, <00:00:44.733>sealed <00:00:45.199>classes,

12
00:00:46.130 --> 00:00:48.930
<00:00:46.130>and <00:00:46.596>pattern <00:00:47.063>matching <00:00:47.530>records.

13
00:00:49.630 --> 00:00:53.970
<00:00:49.630>Who <00:00:49.770>here <00:00:49.910>has <00:00:50.050>used <00:00:50.190>this <00:00:50.330>records <00:00:50.470>or <00:00:50.610>has <00:00:50.750>been <00:00:50.890>using <00:00:51.030>records?

14
00:00:55.900 --> 00:00:57.760
<00:00:55.900>Oh, <00:00:56.055>that's <00:00:56.211>so <00:00:56.366>great <00:00:56.522>to <00:00:56.677>see <00:00:56.833>that. <00:00:56.988>So <00:00:57.144>many <00:00:57.300>hands.

15
00:00:58.520 --> 00:01:02.400
<00:00:58.520>I <00:00:58.620>just <00:00:58.720>realized <00:00:58.820>yesterday <00:00:58.920>it's <00:00:59.020>already <00:00:59.120>been <00:00:59.220>in <00:00:59.320>the <00:00:59.420>language <00:00:59.520>for <00:00:59.620>like <00:00:59.720>two <00:00:59.820>and <00:00:59.920>a

16
00:01:02.400 --> 00:01:07.240
<00:01:02.400>half <00:01:02.527>years <00:01:02.654>and <00:01:02.781>still <00:01:02.909>I <00:01:03.036>think <00:01:03.163>a <00:01:03.290>lot <00:01:03.418>of <00:01:03.545>people <00:01:03.672>don't <00:01:03.800>really

17
00:01:07.910 --> 00:01:10.000
<00:01:07.910>know <00:01:08.143>about <00:01:08.376>it <00:01:08.610>or <00:01:08.843>not <00:01:09.076>using <00:01:09.310>it.

18
00:01:10.680 --> 00:01:14.280
<00:01:10.680>I <00:01:10.780>guess <00:01:10.880>maybe <00:01:10.980>if <00:01:11.080>you're <00:01:11.180>unlucky <00:01:11.280>and <00:01:11.380>you're <00:01:11.480>stuck <00:01:11.580>on <00:01:11.680>one <00:01:11.780>of <00:01:11.880>the <00:01:11.980>older <00:01:12.080>Java

19
00:01:14.280 --> 00:01:17.440
<00:01:14.280>versions, <00:01:14.480>eight <00:01:14.680>11. <00:01:14.880>So <00:01:15.080>what <00:01:15.280>is <00:01:15.480>a <00:01:15.680>record?

20
00:01:17.630 --> 00:01:21.440
<00:01:17.630>It's <00:01:17.804>just <00:01:17.979>a <00:01:18.155>lightweight <00:01:18.330>data <00:01:18.505>carrier <00:01:18.679>that <00:01:18.854>is <00:01:19.030>immutable.

21
00:01:22.420 --> 00:01:25.400
<00:01:22.420>You <00:01:22.575>define <00:01:22.731>a <00:01:22.886>record <00:01:23.042>like <00:01:23.197>this, <00:01:23.353>like <00:01:23.508>it's <00:01:23.664>a <00:01:23.820>class,

22
00:01:26.900 --> 00:01:29.640
<00:01:26.900>and <00:01:27.180>what <00:01:27.460>you're <00:01:27.740>doing <00:01:28.020>is <00:01:28.300>actually,

23
00:01:29.820 --> 00:01:34.400
<00:01:29.820>you <00:01:29.994>are <00:01:30.169>also <00:01:30.345>defining <00:01:30.520>the <00:01:30.695>instance <00:01:30.869>variables <00:01:31.044>right <00:01:31.220>away,

24
00:01:34.780 --> 00:01:37.840
<00:01:34.780>and <00:01:34.955>I <00:01:35.130>have <00:01:35.305>to <00:01:35.480>say <00:01:35.655>their <00:01:35.830>final <00:01:36.005>instance <00:01:36.180>variables,

25
00:01:38.050 --> 00:01:40.480
<00:01:38.050>which <00:01:38.283>means <00:01:38.516>once <00:01:38.750>the <00:01:38.983>construction <00:01:39.216>is <00:01:39.450>completed,

26
00:01:40.940 --> 00:01:43.000
<00:01:40.940>you <00:01:41.220>can't <00:01:41.500>change <00:01:41.780>their <00:01:42.060>values <00:01:42.340>anymore.

27
00:01:46.130 --> 00:01:48.630
<00:01:46.130>You <00:01:46.270>can <00:01:46.410>create <00:01:46.550>them <00:01:46.690>like <00:01:46.830>you <00:01:46.970>can <00:01:47.110>create <00:01:47.250>a <00:01:47.390>Java <00:01:47.530>class,

28
00:01:48.780 --> 00:01:53.670
<00:01:48.780>find <00:01:48.887>a <00:01:48.995>new <00:01:49.103>keyword <00:01:49.210>and <00:01:49.318>retrieving <00:01:49.426>the <00:01:49.533>value <00:01:49.641>from <00:01:49.749>the <00:01:49.856>instance <00:01:49.964>variables <00:01:50.072>is <00:01:50.180>quite

29
00:01:53.670 --> 00:01:58.150
<00:01:53.670>simple. <00:01:53.845>Um, <00:01:54.020>instead <00:01:54.195>of <00:01:54.370>getters, <00:01:54.545>you <00:01:54.720>basically <00:01:54.895>can <00:01:55.070>use,

30
00:01:58.970 --> 00:02:03.350
<00:01:58.970>you <00:01:59.077>can <00:01:59.185>call <00:01:59.293>an <00:01:59.400>accessor <00:01:59.508>method <00:01:59.616>that <00:01:59.723>has <00:01:59.831>the <00:01:59.939>same <00:02:00.046>name <00:02:00.154>as <00:02:00.262>the <00:02:00.370>field.

31
00:02:06.490 --> 00:02:11.190
<00:02:06.490>Now <00:02:06.589>records <00:02:06.690>could <00:02:06.789>typically <00:02:06.890>be <00:02:06.990>used <00:02:07.089>in <00:02:07.190>a <00:02:07.289>scenario <00:02:07.390>where <00:02:07.490>say <00:02:07.589>you've <00:02:07.690>got <00:02:07.789>a <00:02:07.890>rest,

32
00:02:11.350 --> 00:02:11.980
<00:02:11.350>a <00:02:11.633>p <00:02:11.917>i,

33
00:02:11.980 --> 00:02:16.830
<00:02:11.980>some <00:02:12.079>data <00:02:12.179>comes <00:02:12.280>in <00:02:12.380>some <00:02:12.480>J <00:02:12.579>payload <00:02:12.679>and <00:02:12.780>you <00:02:12.880>wanna <00:02:12.980>convert <00:02:13.079>it <00:02:13.179>into <00:02:13.280>some <00:02:13.380>structure.

34
00:02:18.060 --> 00:02:22.550
<00:02:18.060>Records <00:02:18.200>would <00:02:18.340>be <00:02:18.480>really <00:02:18.620>brilliant <00:02:18.760>for <00:02:18.900>that, <00:02:19.040>for <00:02:19.180>two <00:02:19.320>reasons. <00:02:19.460>Um,

35
00:02:22.780 --> 00:02:23.510
<00:02:22.780>it's <00:02:23.436>again,

36
00:02:23.510 --> 00:02:28.030
<00:02:23.510>lightweight <00:02:23.637>and <00:02:23.764>very <00:02:23.891>little <00:02:24.019>coding <00:02:24.146>because <00:02:24.273>if <00:02:24.400>you <00:02:24.528>write <00:02:24.655>the <00:02:24.782>first <00:02:24.910>line,

37
00:02:28.250 --> 00:02:32.510
<00:02:28.250>you'll <00:02:28.366>get <00:02:28.483>uh, <00:02:28.600>the <00:02:28.716>equals <00:02:28.833>the <00:02:28.950>hash <00:02:29.066>code, <00:02:29.183>the, <00:02:29.300>the, <00:02:29.416>the <00:02:29.533>accessor <00:02:29.650>methods,

38
00:02:32.690 --> 00:02:34.310
<00:02:32.690>the <00:02:33.040>constructors, <00:02:33.390>the <00:02:33.740>two <00:02:34.090>string,

39
00:02:34.730 --> 00:02:38.630
<00:02:34.730>all <00:02:34.869>the <00:02:35.010>Java <00:02:35.149>stuff <00:02:35.290>that <00:02:35.429>you <00:02:35.570>normally <00:02:35.709>need <00:02:35.850>to <00:02:35.989>generate. <00:02:36.130>Uh,

40
00:02:38.650 --> 00:02:42.430
<00:02:38.650>second <00:02:38.825>thing <00:02:39.000>is <00:02:39.175>you <00:02:39.350>can't <00:02:39.525>use <00:02:39.700>reflection <00:02:39.875>on <00:02:40.050>records,

41
00:02:42.560 --> 00:02:47.270
<00:02:42.560>which <00:02:42.676>makes <00:02:42.793>it <00:02:42.910>really <00:02:43.026>safe <00:02:43.143>because <00:02:43.260>normally <00:02:43.376>you <00:02:43.493>don't <00:02:43.610>know <00:02:43.726>if <00:02:43.843>you <00:02:43.960>use

42
00:02:47.270 --> 00:02:51.350
<00:02:47.270>Jackson <00:02:47.397>for <00:02:47.524>serializing, <00:02:47.651>Jason <00:02:47.779>and, <00:02:47.906>and, <00:02:48.033>and, <00:02:48.160>and <00:02:48.288>creating <00:02:48.415>a <00:02:48.542>Java <00:02:48.670>object,

43
00:02:51.770 --> 00:02:54.590
<00:02:51.770>you're <00:02:51.925>not <00:02:52.081>really <00:02:52.236>sure <00:02:52.392>what <00:02:52.547>Jason <00:02:52.703>does, <00:02:52.858>what <00:02:53.014>Jackson <00:02:53.170>does,

44
00:02:54.890 --> 00:02:59.840
<00:02:54.890>it <00:02:55.029>could <00:02:55.170>actually <00:02:55.309>just <00:02:55.450>set <00:02:55.589>the <00:02:55.730>variables <00:02:55.869>underwater <00:02:56.010>directly. <00:02:56.149>Fire <00:02:56.290>reflection,

45
00:03:00.050 --> 00:03:04.360
<00:03:00.050>reflection <00:03:00.205>is <00:03:00.361>not <00:03:00.516>allowed. <00:03:00.672>It'll <00:03:00.827>always <00:03:00.983>go <00:03:01.138>past <00:03:01.294>the <00:03:01.450>constructor.

46
00:03:05.100 --> 00:03:05.960
<00:03:05.100>And <00:03:05.293>the <00:03:05.487>good <00:03:05.680>thing <00:03:05.874>is

47
00:03:07.660 --> 00:03:10.550
<00:03:07.660>you <00:03:08.010>can <00:03:08.359>have <00:03:08.710>this <00:03:09.060>um,

48
00:03:11.500 --> 00:03:12.870
<00:03:11.500>compact <00:03:12.733>constructor,

49
00:03:13.160 --> 00:03:16.990
<00:03:13.160>which <00:03:13.299>we <00:03:13.440>see <00:03:13.579>here <00:03:13.720>and <00:03:13.859>there <00:03:14.000>you <00:03:14.140>can <00:03:14.280>do <00:03:14.420>your <00:03:14.560>validations.

50
00:03:17.410 --> 00:03:21.190
<00:03:17.410>So <00:03:17.526>in <00:03:17.643>the <00:03:17.760>compact <00:03:17.876>constructor <00:03:17.993>you <00:03:18.109>don't <00:03:18.226>have <00:03:18.343>to <00:03:18.460>tell <00:03:18.576>the <00:03:18.693>constructor, <00:03:18.810>um,

51
00:03:22.020 --> 00:03:26.950
<00:03:22.020>what <00:03:22.127>are <00:03:22.235>the <00:03:22.343>variables <00:03:22.450>or <00:03:22.558>the <00:03:22.666>parameters <00:03:22.773>that <00:03:22.881>comes <00:03:22.989>in <00:03:23.096>because <00:03:23.204>it <00:03:23.312>already <00:03:23.420>knows

52
00:03:27.770 --> 00:03:30.470
<00:03:27.770>you <00:03:28.003>don't <00:03:28.236>have <00:03:28.470>to <00:03:28.703>assign <00:03:28.936>new <00:03:29.170>values

53
00:03:32.480 --> 00:03:36.340
<00:03:32.480>to <00:03:32.607>the <00:03:32.734>instance <00:03:32.861>variables <00:03:32.989>because <00:03:33.116>the <00:03:33.243>compiler <00:03:33.370>will <00:03:33.498>do <00:03:33.625>it <00:03:33.752>for <00:03:33.880>you.

54
00:03:36.600 --> 00:03:38.620
<00:03:36.600>So <00:03:36.880>it's <00:03:37.160>very <00:03:37.440>easy <00:03:37.720>and <00:03:38.000>very

55
00:03:40.880 --> 00:03:44.230
<00:03:40.880>short <00:03:41.113>coded. <00:03:41.346>Moving <00:03:41.579>on <00:03:41.813>to <00:03:42.046>sealed <00:03:42.280>classes.

56
00:03:45.690 --> 00:03:49.470
<00:03:45.690>So <00:03:45.923>who's <00:03:46.156>familiar <00:03:46.390>with <00:03:46.623>sealed <00:03:46.856>classes? <00:03:47.090>Okay,

57
00:03:49.490 --> 00:03:53.990
<00:03:49.490>that's <00:03:49.606>a <00:03:49.723>few <00:03:49.840>fewer <00:03:49.956>hands, <00:03:50.073>right? <00:03:50.190>The <00:03:50.306>idea <00:03:50.423>of <00:03:50.540>sealed <00:03:50.656>classes <00:03:50.773>is <00:03:50.890>simple.

58
00:03:54.290 --> 00:03:58.550
<00:03:54.290>If <00:03:54.417>you <00:03:54.544>think <00:03:54.671>about <00:03:54.799>Java <00:03:54.926>and <00:03:55.053>object <00:03:55.180>inheritance, <00:03:55.308>basically <00:03:55.435>you've <00:03:55.562>got <00:03:55.690>two

59
00:04:00.060 --> 00:04:01.780
<00:04:00.060>possible <00:04:00.410>options. <00:04:00.760>Either <00:04:01.110>you <00:04:01.460>say,

60
00:04:01.780 --> 00:04:05.540
<00:04:01.780>oh <00:04:01.907>well <00:04:02.034>I <00:04:02.161>got <00:04:02.289>a <00:04:02.416>public <00:04:02.543>class <00:04:02.670>and <00:04:02.798>anyone <00:04:02.925>can <00:04:03.052>potentially <00:04:03.180>inherit,

61
00:04:06.480 --> 00:04:11.290
<00:04:06.480>or <00:04:06.573>you <00:04:06.666>make <00:04:06.760>your <00:04:06.853>class <00:04:06.946>final <00:04:07.040>and <00:04:07.133>no <00:04:07.226>one <00:04:07.320>can <00:04:07.413>inherit <00:04:07.506>from <00:04:07.600>it, <00:04:07.693>not <00:04:07.786>even <00:04:07.880>yourself,

62
00:04:11.830 --> 00:04:16.290
<00:04:11.830>but <00:04:11.946>sometimes <00:04:12.063>you <00:04:12.180>would <00:04:12.296>like <00:04:12.413>a <00:04:12.530>little <00:04:12.646>more <00:04:12.763>fine <00:04:12.880>grain <00:04:12.996>control <00:04:13.113>over <00:04:13.230>OPEC

63
00:04:16.400 --> 00:04:19.720
<00:04:16.399>inheritance. <00:04:16.633>That's <00:04:16.866>where <00:04:17.099>sealed <00:04:17.333>clause <00:04:17.566>come <00:04:17.799>in.

64
00:04:20.420 --> 00:04:23.400
<00:04:20.420>So <00:04:20.595>you <00:04:20.770>can <00:04:20.945>define <00:04:21.120>it <00:04:21.295>with <00:04:21.470>the <00:04:21.645>keyword <00:04:21.820>sealed,

65
00:04:24.140 --> 00:04:26.480
<00:04:24.140>you <00:04:24.340>can <00:04:24.539>use <00:04:24.740>it <00:04:24.940>on <00:04:25.140>clause <00:04:25.340>and <00:04:25.539>interfaces

66
00:04:28.070 --> 00:04:30.130
<00:04:28.070>and <00:04:28.245>then <00:04:28.420>you <00:04:28.594>have <00:04:28.770>to <00:04:28.945>tell <00:04:29.120>'em, <00:04:29.295>okay, <00:04:29.469>so,

67
00:04:30.190 --> 00:04:34.990
<00:04:30.190>so <00:04:30.306>some <00:04:30.423>classes <00:04:30.540>are <00:04:30.656>allowed <00:04:30.773>to <00:04:30.890>inherit <00:04:31.006>from <00:04:31.123>me, <00:04:31.240>who <00:04:31.356>will <00:04:31.473>it <00:04:31.590>be?

68
00:04:35.250 --> 00:04:40.230
<00:04:35.250>So <00:04:35.357>after <00:04:35.465>the <00:04:35.573>permits <00:04:35.680>clause <00:04:35.788>you <00:04:35.896>have <00:04:36.003>to <00:04:36.111>tell <00:04:36.219>approver <00:04:36.326>project <00:04:36.434>manager <00:04:36.542>and <00:04:36.650>a

69
00:04:40.230 --> 00:04:44.620
<00:04:40.230>regular <00:04:40.346>user <00:04:40.463>they <00:04:40.580>can <00:04:40.696>inherit <00:04:40.813>from <00:04:40.930>me. <00:04:41.046>Any <00:04:41.163>other <00:04:41.280>class <00:04:41.396>trying <00:04:41.513>to <00:04:41.630>inherit,

70
00:04:44.970 --> 00:04:46.900
<00:04:44.970>it's <00:04:45.170>not <00:04:45.370>gonna <00:04:45.570>work, <00:04:45.770>the <00:04:45.970>compiler <00:04:46.170>will <00:04:46.370>fail.

71
00:04:49.200 --> 00:04:51.300
<00:04:49.200>Now <00:04:49.400>each <00:04:49.599>of <00:04:49.800>the <00:04:50.000>subclasses <00:04:50.200>you <00:04:50.400>meant <00:04:50.599>there,

72
00:04:51.840 --> 00:04:56.260
<00:04:51.840>you <00:04:51.956>have <00:04:52.073>to <00:04:52.190>tell <00:04:52.306>for <00:04:52.423>them <00:04:52.540>how <00:04:52.656>are <00:04:52.773>they <00:04:52.890>gonna <00:04:53.006>handle <00:04:53.123>their <00:04:53.240>inheritance.

73
00:04:57.590 --> 00:05:01.370
<00:04:57.590>So <00:04:57.706>there's <00:04:57.823>three <00:04:57.940>options. <00:04:58.056>The <00:04:58.173>first <00:04:58.290>one <00:04:58.406>would <00:04:58.523>be <00:04:58.640>that <00:04:58.756>you <00:04:58.873>say, <00:04:58.990>oh,

74
00:05:01.480 --> 00:05:03.130
<00:05:01.480>he's <00:05:01.830>also <00:05:02.180>sealed. <00:05:02.530>So <00:05:02.880>again,

75
00:05:03.150 --> 00:05:07.530
<00:05:03.150>he <00:05:03.257>has <00:05:03.365>to <00:05:03.473>specify <00:05:03.580>in <00:05:03.688>the <00:05:03.796>permits <00:05:03.903>clause <00:05:04.011>who's <00:05:04.119>allowed <00:05:04.226>to <00:05:04.334>inherit <00:05:04.442>from <00:05:04.549>him.

76
00:05:09.230 --> 00:05:12.210
<00:05:09.230>The <00:05:09.357>second <00:05:09.484>option <00:05:09.611>would <00:05:09.739>be <00:05:09.866>make <00:05:09.993>it <00:05:10.120>final, <00:05:10.248>you <00:05:10.375>know, <00:05:10.502>public <00:05:10.630>final.

77
00:05:12.350 --> 00:05:17.090
<00:05:12.350>So <00:05:12.450>this <00:05:12.550>is <00:05:12.650>where <00:05:12.750>then <00:05:12.850>no <00:05:12.950>one <00:05:13.050>is <00:05:13.150>allowed <00:05:13.250>to <00:05:13.350>inherit <00:05:13.450>or <00:05:13.550>the <00:05:13.650>third <00:05:13.750>option

78
00:05:18.000 --> 00:05:20.410
<00:05:18.000>basically <00:05:18.280>it's <00:05:18.560>an <00:05:18.840>open <00:05:19.120>all <00:05:19.400>option.

79
00:05:21.110 --> 00:05:23.090
<00:05:21.110>You're <00:05:21.390>saying <00:05:21.670>no <00:05:21.950>from <00:05:22.230>here <00:05:22.510>on,

80
00:05:23.200 --> 00:05:26.450
<00:05:23.200>it's <00:05:23.479>no <00:05:23.760>unsealed <00:05:24.039>anyone <00:05:24.320>can <00:05:24.599>inherit.

81
00:05:27.190 --> 00:05:31.490
<00:05:27.190>Now <00:05:27.306>that <00:05:27.423>might <00:05:27.540>seem <00:05:27.656>weird <00:05:27.773>at <00:05:27.890>first <00:05:28.006>because <00:05:28.123>suddenly <00:05:28.240>you're <00:05:28.356>crafting <00:05:28.473>is <00:05:28.590>very

82
00:05:31.490 --> 00:05:34.730
<00:05:31.490>careful <00:05:31.645>inheritance <00:05:31.801>tree <00:05:31.956>and <00:05:32.112>then <00:05:32.267>you're <00:05:32.423>say <00:05:32.578>it <00:05:32.734>doesn't <00:05:32.890>care.

83
00:05:34.790 --> 00:05:35.810
<00:05:34.790>Anyone <00:05:35.249>can <00:05:35.708>inherit.

84
00:05:36.470 --> 00:05:41.330
<00:05:36.470>But <00:05:36.645>the <00:05:36.820>compiler <00:05:36.995>always <00:05:37.170>knows <00:05:37.345>that <00:05:37.520>any <00:05:37.695>class <00:05:37.870>inheriting

85
00:05:41.800 --> 00:05:44.610
<00:05:41.800>from <00:05:42.033>regular <00:05:42.266>user <00:05:42.500>is <00:05:42.733>a <00:05:42.966>regular <00:05:43.200>user.

86
00:05:44.750 --> 00:05:47.570
<00:05:44.750>So <00:05:44.950>it <00:05:45.150>can <00:05:45.350>still <00:05:45.550>reason <00:05:45.750>about <00:05:45.950>the <00:05:46.150>logic.

87
00:05:48.820 --> 00:05:52.840
<00:05:48.820>Now <00:05:48.927>this <00:05:49.035>comes <00:05:49.143>in <00:05:49.250>handy <00:05:49.358>when <00:05:49.466>we <00:05:49.573>look <00:05:49.681>at <00:05:49.789>pattern <00:05:49.896>matching <00:05:50.004>a <00:05:50.112>bit <00:05:50.219>later.

88
00:05:54.520 --> 00:05:56.470
<00:05:54.520>First <00:05:54.753>of <00:05:54.986>all, <00:05:55.219>what <00:05:55.453>is <00:05:55.686>pattern <00:05:55.919>matching?

89
00:05:57.140 --> 00:06:01.900
<00:05:57.140>You've <00:05:57.267>got <00:05:57.394>a <00:05:57.521>predicate <00:05:57.649>you're <00:05:57.776>going <00:05:57.903>to <00:05:58.030>object <00:05:58.158>against <00:05:58.285>which <00:05:58.412>you're <00:05:58.539>gonna

90
00:06:01.930 --> 00:06:05.220
<00:06:01.930>test. <00:06:02.163>Then <00:06:02.396>if <00:06:02.630>the <00:06:02.863>test <00:06:03.096>is <00:06:03.330>successful,

91
00:06:05.300 --> 00:06:08.260
<00:06:05.300>there're <00:06:05.533>gonna <00:06:05.766>be <00:06:06.000>some <00:06:06.233>pattern <00:06:06.466>variables <00:06:06.700>extracted,

92
00:06:09.310 --> 00:06:12.220
<00:06:09.310>which <00:06:09.437>are <00:06:09.564>gonna <00:06:09.691>be <00:06:09.819>in <00:06:09.946>flow <00:06:10.073>scope. <00:06:10.200>Let's <00:06:10.328>look <00:06:10.455>at <00:06:10.582>an <00:06:10.710>example.

93
00:06:13.200 --> 00:06:16.980
<00:06:13.200>If <00:06:13.375>we <00:06:13.550>here <00:06:13.724>say <00:06:13.900>return <00:06:14.075>user <00:06:14.250>instance <00:06:14.425>of <00:06:14.599>approver,

94
00:06:17.570 --> 00:06:19.900
<00:06:17.570>that <00:06:17.725>seems <00:06:17.881>like <00:06:18.036>the <00:06:18.192>normal <00:06:18.347>instance <00:06:18.503>of, <00:06:18.658>but <00:06:18.814>it <00:06:18.969>isn't.

95
00:06:19.900 --> 00:06:24.180
<00:06:19.900>It's <00:06:20.007>the <00:06:20.115>first <00:06:20.223>patent <00:06:20.330>brought <00:06:20.438>to <00:06:20.546>Java <00:06:20.653>and <00:06:20.761>you <00:06:20.869>see <00:06:20.976>this <00:06:21.084>little <00:06:21.192>A <00:06:21.299>after

96
00:06:24.380 --> 00:06:27.660
<00:06:24.380>approver, <00:06:24.613>which <00:06:24.846>basically <00:06:25.080>is <00:06:25.313>the <00:06:25.546>patent <00:06:25.780>variable.

97
00:06:28.360 --> 00:06:33.010
<00:06:28.360>So <00:06:28.500>the <00:06:28.640>predicate <00:06:28.780>here <00:06:28.920>is <00:06:29.060>instance <00:06:29.200>of <00:06:29.340>with <00:06:29.480>testing <00:06:29.620>it <00:06:29.760>against

98
00:06:33.120 --> 00:06:37.050
<00:06:33.120>user. <00:06:33.470>If <00:06:33.820>it <00:06:34.170>is <00:06:34.520>successful,

99
00:06:37.720 --> 00:06:41.690
<00:06:37.720>then <00:06:37.895>a <00:06:38.070>will <00:06:38.245>be <00:06:38.420>casted <00:06:38.595>to <00:06:38.770>an <00:06:38.945>approval <00:06:39.120>record.

100
00:06:41.870 --> 00:06:45.410
<00:06:41.870>So <00:06:41.997>it's <00:06:42.124>a <00:06:42.251>bit <00:06:42.379>for <00:06:42.506>people <00:06:42.633>who <00:06:42.760>know <00:06:42.888>Kotlin <00:06:43.015>like <00:06:43.142>smart <00:06:43.270>casting.

101
00:06:46.730 --> 00:06:51.150
<00:06:46.730>And <00:06:46.830>it <00:06:46.930>is <00:06:47.030>a <00:06:47.130>flow <00:06:47.230>scope <00:06:47.330>that <00:06:47.430>means <00:06:47.530>the <00:06:47.630>A <00:06:47.730>only <00:06:47.830>exists <00:06:47.930>between <00:06:48.030>the <00:06:48.130>brackets.

102
00:06:54.310 --> 00:06:57.560
<00:06:54.310>Pattern <00:06:54.510>matching <00:06:54.710>has <00:06:54.910>undergone <00:06:55.110>a <00:06:55.310>number <00:06:55.510>of <00:06:55.710>changes,

103
00:06:58.220 --> 00:07:02.400
<00:06:58.220>and <00:06:58.320>in <00:06:58.420>one <00:06:58.520>of <00:06:58.620>the <00:06:58.720>later <00:06:58.820>versions <00:06:58.920>of <00:06:59.020>Java <00:06:59.120>we <00:06:59.220>got <00:06:59.320>pattern <00:06:59.420>matching <00:06:59.520>for <00:06:59.620>switch,

104
00:07:03.130 --> 00:07:05.080
<00:07:03.130>which <00:07:03.480>is <00:07:03.830>basically <00:07:04.180>like <00:07:04.530>this.

105
00:07:05.550 --> 00:07:09.000
<00:07:05.550>Here <00:07:05.637>we <00:07:05.725>are <00:07:05.812>doing <00:07:05.900>a <00:07:05.987>switch <00:07:06.075>and <00:07:06.162>this <00:07:06.250>is <00:07:06.337>one <00:07:06.425>of <00:07:06.512>the <00:07:06.600>new <00:07:06.687>switch <00:07:06.775>types <00:07:06.862>with <00:07:06.950>the

106
00:07:09.000 --> 00:07:12.720
<00:07:09.000>error <00:07:09.200>operator. <00:07:09.400>And <00:07:09.600>basically <00:07:09.800>you're <00:07:10.000>saying <00:07:10.200>here, <00:07:10.400>okay,

107
00:07:12.720 --> 00:07:14.880
<00:07:12.720>switch <00:07:12.920>is <00:07:13.120>an <00:07:13.320>approval, <00:07:13.520>is <00:07:13.720>it <00:07:13.920>an <00:07:14.120>approver,

108
00:07:15.020 --> 00:07:17.360
<00:07:15.020>is <00:07:15.195>it <00:07:15.370>a <00:07:15.544>project <00:07:15.719>manager <00:07:15.895>or <00:07:16.070>a <00:07:16.245>regular <00:07:16.419>user?

109
00:07:17.860 --> 00:07:22.480
<00:07:17.860>And <00:07:17.967>suddenly <00:07:18.075>here <00:07:18.183>you're <00:07:18.290>seeing <00:07:18.398>a <00:07:18.506>bit <00:07:18.613>of <00:07:18.721>the <00:07:18.829>part <00:07:18.936>of <00:07:19.044>this <00:07:19.152>data <00:07:19.260>oriented

110
00:07:22.480 --> 00:07:26.520
<00:07:22.480>programming <00:07:22.596>we <00:07:22.713>will <00:07:22.830>get <00:07:22.946>to <00:07:23.063>because <00:07:23.180>normally <00:07:23.296>it <00:07:23.413>would <00:07:23.530>say <00:07:23.646>something <00:07:23.763>like <00:07:23.880>number,

111
00:07:26.540 --> 00:07:27.920
<00:07:26.540>number <00:07:26.954>one, <00:07:27.368>number <00:07:27.782>two,

112
00:07:28.220 --> 00:07:32.800
<00:07:28.220>but <00:07:28.360>now <00:07:28.500>we're <00:07:28.640>actually <00:07:28.780>taking <00:07:28.920>objects <00:07:29.060>and <00:07:29.200>treating <00:07:29.340>them <00:07:29.480>like <00:07:29.620>first

113
00:07:32.920 --> 00:07:37.000
<00:07:32.920>class <00:07:33.036>citizens. <00:07:33.153>We <00:07:33.270>are <00:07:33.386>reasoning <00:07:33.503>about <00:07:33.620>the <00:07:33.736>objects <00:07:33.853>as <00:07:33.970>if <00:07:34.086>they <00:07:34.203>were <00:07:34.320>data,

114
00:07:38.170 --> 00:07:41.640
<00:07:38.170>right? <00:07:38.370>What <00:07:38.570>happens <00:07:38.770>here, <00:07:38.970>if <00:07:39.170>you <00:07:39.370>remember <00:07:39.570>this,

115
00:07:42.020 --> 00:07:45.600
<00:07:42.020>the <00:07:42.159>compiler <00:07:42.299>knew <00:07:42.440>that <00:07:42.580>user <00:07:42.719>could <00:07:42.859>only <00:07:43.000>have <00:07:43.140>three <00:07:43.280>possible <00:07:43.419>values.

116
00:07:46.340 --> 00:07:50.920
<00:07:46.340>That's <00:07:46.456>why <00:07:46.573>you <00:07:46.690>don't <00:07:46.806>have <00:07:46.923>to <00:07:47.040>specify <00:07:47.156>a <00:07:47.273>default <00:07:47.390>clause <00:07:47.506>here <00:07:47.623>in <00:07:47.740>this

117
00:07:51.120 --> 00:07:55.000
<00:07:51.120>switch <00:07:51.247>because <00:07:51.374>the <00:07:51.501>compiler <00:07:51.629>knows, <00:07:51.756>oh, <00:07:51.883>you <00:07:52.010>handled <00:07:52.138>each <00:07:52.265>and <00:07:52.392>every <00:07:52.520>case,

118
00:07:55.420 --> 00:07:57.200
<00:07:55.420>so <00:07:55.700>no <00:07:55.980>problem, <00:07:56.260>it <00:07:56.540>won't <00:07:56.820>complain.

119
00:07:58.890 --> 00:08:01.870
<00:07:58.890>If <00:07:59.030>you <00:07:59.169>ever <00:07:59.310>would <00:07:59.450>extend <00:07:59.590>the <00:07:59.729>interface <00:07:59.870>with <00:08:00.010>the <00:08:00.150>fourth <00:08:00.289>class,

120
00:08:02.290 --> 00:08:05.470
<00:08:02.290>all <00:08:02.397>these <00:08:02.505>parts <00:08:02.613>will <00:08:02.720>break <00:08:02.828>and <00:08:02.936>the <00:08:03.043>compiler <00:08:03.151>will <00:08:03.259>actually <00:08:03.366>show <00:08:03.474>you <00:08:03.582>where <00:08:03.690>you

121
00:08:05.470 --> 00:08:08.920
<00:08:05.470>need <00:08:05.750>to <00:08:06.030>update <00:08:06.310>your <00:08:06.590>code. <00:08:06.870>Um,

122
00:08:11.240 --> 00:08:16.200
<00:08:11.240>then <00:08:11.473>there's <00:08:11.706>also <00:08:11.940>a <00:08:12.173>sub <00:08:12.406>situation <00:08:12.640>because

123
00:08:16.390 --> 00:08:18.600
<00:08:16.390>here <00:08:16.669>now <00:08:16.950>we're <00:08:17.229>saying <00:08:17.510>case <00:08:17.789>approver

124
00:08:20.720 --> 00:08:25.160
<00:08:20.720>A <00:08:20.836>and <00:08:20.953>then <00:08:21.070>when <00:08:21.186>A <00:08:21.303>is <00:08:21.420>active. <00:08:21.536>So <00:08:21.653>this <00:08:21.770>is <00:08:21.886>a <00:08:22.003>guarded <00:08:22.120>pattern.

125
00:08:26.180 --> 00:08:27.760
<00:08:26.180>So <00:08:26.460>basically <00:08:26.740>we <00:08:27.020>are <00:08:27.300>saying <00:08:27.580>here,

126
00:08:27.860 --> 00:08:32.800
<00:08:27.860>we <00:08:27.967>only <00:08:28.075>want <00:08:28.183>this <00:08:28.290>line <00:08:28.398>of <00:08:28.506>code <00:08:28.613>to <00:08:28.721>be <00:08:28.829>executed <00:08:28.936>under <00:08:29.044>this <00:08:29.152>certain <00:08:29.260>condition.

127
00:08:33.220 --> 00:08:34.320
<00:08:33.220>And <00:08:33.467>once <00:08:33.715>you <00:08:33.962>have <00:08:34.210>that,

128
00:08:34.380 --> 00:08:38.840
<00:08:34.380>you <00:08:34.473>can <00:08:34.566>actually <00:08:34.659>see <00:08:34.753>that <00:08:34.846>a <00:08:34.939>proof <00:08:35.033>needs <00:08:35.126>to <00:08:35.220>be <00:08:35.313>in <00:08:35.406>there <00:08:35.500>twice <00:08:35.593>because <00:08:35.686>you're <00:08:35.780>now

129
00:08:39.040 --> 00:08:43.700
<00:08:39.039>skipping <00:08:39.195>all <00:08:39.351>the <00:08:39.506>situations <00:08:39.662>where <00:08:39.817>it's <00:08:39.973>active <00:08:40.128>would <00:08:40.284>be <00:08:40.439>false.

130
00:08:43.840 --> 00:08:46.460
<00:08:43.840>And <00:08:43.967>then <00:08:44.094>a <00:08:44.221>compiler <00:08:44.349>would <00:08:44.476>say, <00:08:44.603>you're <00:08:44.730>not <00:08:44.858>handling <00:08:44.985>all <00:08:45.112>the <00:08:45.240>cases

131
00:08:50.450 --> 00:08:53.020
<00:08:50.450>Java <00:08:50.683>20 <00:08:50.916>broad <00:08:51.150>pattern <00:08:51.383>matching <00:08:51.616>for <00:08:51.850>records,

132
00:08:53.910 --> 00:08:56.710
<00:08:53.910>which <00:08:54.189>can <00:08:54.469>be <00:08:54.750>really, <00:08:55.030>really <00:08:55.310>powerful.

133
00:08:57.180 --> 00:09:00.670
<00:08:57.180>This <00:08:57.307>is <00:08:57.434>still <00:08:57.561>the <00:08:57.689>instance <00:08:57.816>of <00:08:57.943>pattern <00:08:58.070>matching, <00:08:58.198>which <00:08:58.325>isn't <00:08:58.452>that <00:08:58.579>special.

134
00:09:01.770 --> 00:09:06.590
<00:09:01.770>But <00:09:01.910>then <00:09:02.050>we <00:09:02.189>get <00:09:02.329>to <00:09:02.470>this <00:09:02.610>situation <00:09:02.750>pattern <00:09:02.890>matching <00:09:03.030>for <00:09:03.170>records

135
00:09:06.890 --> 00:09:11.030
<00:09:06.890>on <00:09:06.983>a <00:09:07.076>switch <00:09:07.170>operation. <00:09:07.263>Well, <00:09:07.356>the <00:09:07.449>first <00:09:07.543>thing <00:09:07.636>it <00:09:07.730>can <00:09:07.823>check, <00:09:07.916>it <00:09:08.010>can <00:09:08.103>check <00:09:08.196>for <00:09:08.290>no,

136
00:09:11.030 --> 00:09:15.630
<00:09:11.030>which <00:09:11.146>is <00:09:11.263>really <00:09:11.380>handy. <00:09:11.496>The <00:09:11.613>classical <00:09:11.730>switch <00:09:11.846>operation <00:09:11.963>didn't <00:09:12.079>let <00:09:12.196>you <00:09:12.313>do <00:09:12.430>that.

137
00:09:15.850 --> 00:09:19.990
<00:09:15.850>So <00:09:15.943>you <00:09:16.036>always <00:09:16.130>had <00:09:16.223>to <00:09:16.316>do <00:09:16.410>this <00:09:16.503>no <00:09:16.596>pointer <00:09:16.690>check <00:09:16.783>before <00:09:16.876>you <00:09:16.970>got <00:09:17.063>into <00:09:17.156>the <00:09:17.250>switch.

138
00:09:20.290 --> 00:09:23.510
<00:09:20.290>Now <00:09:20.430>you <00:09:20.569>can <00:09:20.709>handle <00:09:20.849>it <00:09:20.990>inside, <00:09:21.130>which <00:09:21.270>makes <00:09:21.410>the <00:09:21.550>code <00:09:21.689>elegantly.

139
00:09:24.410 --> 00:09:29.390
<00:09:24.410>The <00:09:24.510>second <00:09:24.610>thing <00:09:24.709>is <00:09:24.810>this <00:09:24.910>case <00:09:25.010>user <00:09:25.110>record. <00:09:25.209>And <00:09:25.310>remember <00:09:25.410>we <00:09:25.510>had <00:09:25.610>this <00:09:25.709>user <00:09:25.810>record,

140
00:09:29.390 --> 00:09:31.910
<00:09:29.390>which <00:09:29.670>is <00:09:29.949>four <00:09:30.230>variables <00:09:30.510>in <00:09:30.790>there.

141
00:09:32.690 --> 00:09:36.390
<00:09:32.690>And <00:09:32.865>basically <00:09:33.040>what <00:09:33.215>this <00:09:33.390>second <00:09:33.565>statement <00:09:33.740>he <00:09:33.915>says <00:09:34.090>is,

142
00:09:36.730 --> 00:09:40.990
<00:09:36.730>please <00:09:36.963>create <00:09:37.196>four <00:09:37.430>local <00:09:37.663>variables <00:09:37.896>for <00:09:38.130>me,

143
00:09:41.910 --> 00:09:43.270
<00:09:41.910>E, <00:09:42.216>P, <00:09:42.521>B <00:09:42.828>and <00:09:43.134>A,

144
00:09:43.490 --> 00:09:47.550
<00:09:43.490>and <00:09:43.630>could <00:09:43.770>you <00:09:43.910>please <00:09:44.050>assign <00:09:44.190>to <00:09:44.330>e <00:09:44.470>the <00:09:44.610>value <00:09:44.750>of <00:09:44.890>record,

145
00:09:47.770 --> 00:09:52.390
<00:09:47.770>do <00:09:47.944>username <00:09:48.120>and <00:09:48.295>to <00:09:48.470>p <00:09:48.645>to <00:09:48.819>value <00:09:48.995>from <00:09:49.170>record

146
00:09:53.550 --> 00:09:54.010
password.

147
00:09:54.010 --> 00:09:58.790
<00:09:54.010>So <00:09:54.126>basically <00:09:54.243>you <00:09:54.360>are <00:09:54.476>deconstructing <00:09:54.593>the <00:09:54.710>record <00:09:54.826>instead <00:09:54.943>of <00:09:55.060>creating <00:09:55.176>it <00:09:55.293>via <00:09:55.410>a

148
00:09:58.790 --> 00:10:03.350
<00:09:58.790>parameters, <00:09:58.945>you're <00:09:59.101>now <00:09:59.256>kind <00:09:59.412>of <00:09:59.567>unpacking <00:09:59.723>it <00:09:59.878>into <00:10:00.034>local <00:10:00.189>variables,

149
00:10:03.440 --> 00:10:04.950
<00:10:03.440>which <00:10:03.779>can <00:10:04.119>be <00:10:04.459>really <00:10:04.799>powerful.

150
00:10:06.420 --> 00:10:10.830
<00:10:06.420>Then <00:10:06.594>Java <00:10:06.770>20 <00:10:06.944>or <00:10:07.120>a <00:10:07.295>small <00:10:07.469>addition <00:10:07.645>to <00:10:07.819>this

151
00:10:11.140 --> 00:10:15.670
<00:10:11.140>here <00:10:11.256>we <00:10:11.373>still <00:10:11.490>had <00:10:11.606>to <00:10:11.723>specify <00:10:11.840>in <00:10:11.956>19 <00:10:12.073>the <00:10:12.189>type <00:10:12.306>of <00:10:12.423>the <00:10:12.540>variables,

152
00:10:16.780 --> 00:10:20.360
<00:10:16.780>but <00:10:16.920>in <00:10:17.060>20, <00:10:17.199>the <00:10:17.339>compiler <00:10:17.480>was <00:10:17.620>smart <00:10:17.760>enough <00:10:17.900>to <00:10:18.040>say, <00:10:18.180>oh,

153
00:10:20.480 --> 00:10:22.680
<00:10:20.480>I <00:10:20.655>can <00:10:20.830>do <00:10:21.005>actually <00:10:21.180>do <00:10:21.355>type <00:10:21.530>inference <00:10:21.705>for <00:10:21.880>you.

154
00:10:22.860 --> 00:10:27.400
<00:10:22.860>So <00:10:22.960>you <00:10:23.060>can <00:10:23.160>just <00:10:23.260>specify <00:10:23.360>var <00:10:23.460>and <00:10:23.560>the <00:10:23.660>compiler <00:10:23.760>will <00:10:23.860>still <00:10:23.960>know <00:10:24.060>what <00:10:24.160>types <00:10:24.260>they

155
00:10:27.520 --> 00:10:28.353
are.

156
00:10:29.130 --> 00:10:33.230
<00:10:29.130>Java <00:10:29.330>21 <00:10:29.530>brought <00:10:29.730>even <00:10:29.930>more <00:10:30.130>advancements <00:10:30.330>to <00:10:30.530>this,

157
00:10:33.230 --> 00:10:34.790
<00:10:33.230>which <00:10:33.510>we'll <00:10:33.790>see <00:10:34.070>in <00:10:34.350>a <00:10:34.630>bit.

158
00:10:38.140 --> 00:10:42.200
<00:10:38.140>And <00:10:38.240>actually, <00:10:38.340>so <00:10:38.439>you <00:10:38.540>can <00:10:38.640>make <00:10:38.740>a <00:10:38.840>really <00:10:38.939>powerful <00:10:39.040>code <00:10:39.140>like <00:10:39.240>here <00:10:39.340>where <00:10:39.439>you, <00:10:39.540>uh,

159
00:10:42.780 --> 00:10:44.480
<00:10:42.780>taking <00:10:43.130>a <00:10:43.480>list <00:10:43.829>of <00:10:44.180>users,

160
00:10:45.260 --> 00:10:50.040
<00:10:45.260>you <00:10:45.387>are <00:10:45.514>looping <00:10:45.641>around <00:10:45.769>a <00:10:45.896>list <00:10:46.023>and <00:10:46.150>you're <00:10:46.278>unpacking <00:10:46.405>it <00:10:46.532>here <00:10:46.660>and

161
00:10:50.040 --> 00:10:54.440
<00:10:50.040>basically <00:10:50.180>you're <00:10:50.319>using <00:10:50.459>b <00:10:50.599>and <00:10:50.740>e <00:10:50.880>as <00:10:51.020>the <00:10:51.160>only <00:10:51.300>variables <00:10:51.439>here.

162
00:10:55.020 --> 00:10:59.920
<00:10:55.020>So <00:10:55.175>the <00:10:55.331>compiler <00:10:55.486>automatically <00:10:55.642>unpacks <00:10:55.797>this <00:10:55.953>record <00:10:56.108>for <00:10:56.264>you <00:10:56.420>into

163
00:11:00.140 --> 00:11:02.380
<00:11:00.140>the <00:11:00.840>variables. <00:11:01.540>Um,

164
00:11:02.610 --> 00:11:05.660
<00:11:02.610>unfortunately <00:11:02.785>in <00:11:02.960>Java <00:11:03.135>21 <00:11:03.310>disco <00:11:03.485>code <00:11:03.660>doesn't <00:11:03.835>work <00:11:04.010>anymore,

165
00:11:06.120 --> 00:11:09.260
<00:11:06.120>but <00:11:06.320>we'll <00:11:06.520>get <00:11:06.720>to <00:11:06.920>that <00:11:07.120>in <00:11:07.320>a <00:11:07.520>second.

166
00:11:09.840 --> 00:11:13.720
<00:11:09.840>And <00:11:09.967>of <00:11:10.094>course <00:11:10.221>here <00:11:10.349>you <00:11:10.476>can <00:11:10.603>also <00:11:10.730>use <00:11:10.858>the <00:11:10.985>VAR <00:11:11.112>thing, <00:11:11.240>right?

167
00:11:15.690 --> 00:11:20.220
<00:11:15.690>Coolest <00:11:15.806>these <00:11:15.923>things <00:11:16.040>are, <00:11:16.156>they're <00:11:16.273>not <00:11:16.390>really <00:11:16.506>the <00:11:16.623>big <00:11:16.740>thing <00:11:16.856>from <00:11:16.973>Java <00:11:17.090>21,

168
00:11:20.220 --> 00:11:23.500
<00:11:20.220>aren't <00:11:20.395>they? <00:11:20.570>Because <00:11:20.745>that <00:11:20.920>is <00:11:21.095>virtual <00:11:21.270>threats. <00:11:21.445>Virtual <00:11:21.620>threats,

169
00:11:23.820 --> 00:11:25.660
<00:11:23.820>a <00:11:24.100>new <00:11:24.380>threading <00:11:24.660>model <00:11:24.940>for <00:11:25.220>Java.

170
00:11:26.820 --> 00:11:30.490
<00:11:26.820>First <00:11:26.995>introduced <00:11:27.170>as <00:11:27.345>a <00:11:27.520>preview <00:11:27.695>feature <00:11:27.870>in <00:11:28.045>Java <00:11:28.220>19,

171
00:11:31.350 --> 00:11:32.490
<00:11:31.350>and <00:11:31.606>now <00:11:31.863>it <00:11:32.119>is <00:11:32.376>final.

172
00:11:32.670 --> 00:11:37.170
<00:11:32.670>It <00:11:32.777>is <00:11:32.885>there <00:11:32.993>for <00:11:33.100>us <00:11:33.208>to <00:11:33.316>start <00:11:33.423>using <00:11:33.531>and <00:11:33.639>are <00:11:33.746>we <00:11:33.854>using <00:11:33.962>it? <00:11:34.069>Well,

173
00:11:37.510 --> 00:11:40.490
<00:11:37.510>spring <00:11:37.743>just <00:11:37.976>released <00:11:38.210>I <00:11:38.443>think <00:11:38.676>version <00:11:38.910>six,

174
00:11:40.550 --> 00:11:43.850
<00:11:40.550>1.2 <00:11:40.829>with <00:11:41.109>support <00:11:41.390>for <00:11:41.670>virtual <00:11:41.949>threats.

175
00:11:45.600 --> 00:11:46.270
Um,

176
00:11:46.270 --> 00:11:50.780
<00:11:46.270>micro <00:11:46.410>node <00:11:46.550>just <00:11:46.689>released <00:11:46.829>version <00:11:46.970>four <00:11:47.110>with <00:11:47.250>support <00:11:47.390>for <00:11:47.530>virtual <00:11:47.670>threats.

177
00:11:52.770 --> 00:11:56.750
<00:11:52.770>QAs, <00:11:52.910>they're <00:11:53.050>the <00:11:53.189>same <00:11:53.329>with <00:11:53.470>a <00:11:53.610>new <00:11:53.750>version. <00:11:53.890>And, <00:11:54.030>and, <00:11:54.170>and,

178
00:11:56.770 --> 00:12:01.750
<00:11:56.770>and <00:11:56.910>Oracle <00:11:57.050>itself <00:11:57.189>is <00:11:57.329>really <00:11:57.470>believing <00:11:57.610>it <00:11:57.750>because <00:11:57.890>they <00:11:58.030>have <00:11:58.170>hella

179
00:12:01.750 --> 00:12:02.583
<00:12:01.750>on <00:12:02.499>nema,

180
00:12:02.960 --> 00:12:07.670
<00:12:02.960>which <00:12:03.115>is <00:12:03.271>using <00:12:03.426>virtual <00:12:03.582>threats <00:12:03.737>solely <00:12:03.893>and <00:12:04.048>actually <00:12:04.204>has <00:12:04.360>taken

181
00:12:07.770 --> 00:12:09.750
<00:12:07.770>out <00:12:08.050>all <00:12:08.329>of <00:12:08.610>the <00:12:08.890>reactive <00:12:09.170>code.

182
00:12:10.450 --> 00:12:13.590
<00:12:10.450>So <00:12:10.683>what <00:12:10.916>is <00:12:11.150>virtual <00:12:11.383>threats <00:12:11.616>all <00:12:11.850>about?

183
00:12:13.760 --> 00:12:15.750
<00:12:13.760>Let's <00:12:13.993>look <00:12:14.226>at <00:12:14.460>normal <00:12:14.693>threading <00:12:14.926>in <00:12:15.160>Java.

184
00:12:15.970 --> 00:12:20.710
<00:12:15.970>The <00:12:16.077>normal <00:12:16.185>threat <00:12:16.293>as <00:12:16.400>we <00:12:16.508>knew <00:12:16.616>it <00:12:16.723>was <00:12:16.831>just <00:12:16.939>a <00:12:17.046>thin <00:12:17.154>wrapper <00:12:17.262>around <00:12:17.370>an

185
00:12:20.710 --> 00:12:24.350
<00:12:20.710>operating <00:12:20.885>system <00:12:21.060>threat. <00:12:21.235>So <00:12:21.410>it's <00:12:21.585>quite <00:12:21.760>expensive <00:12:21.935>to <00:12:22.110>create.

186
00:12:24.810 --> 00:12:26.590
<00:12:24.810>It <00:12:25.160>was <00:12:25.510>quite <00:12:25.859>memory <00:12:26.209>intensive,

187
00:12:27.010 --> 00:12:31.950
<00:12:27.010>it <00:12:27.117>wasn't <00:12:27.225>very <00:12:27.333>scalable <00:12:27.440>and <00:12:27.548>that's <00:12:27.656>why <00:12:27.763>we <00:12:27.871>were <00:12:27.979>always <00:12:28.086>pooling <00:12:28.194>our <00:12:28.302>threats <00:12:28.410>into

188
00:12:31.950 --> 00:12:33.910
<00:12:31.950>threat <00:12:32.150>pools <00:12:32.350>and <00:12:32.550>reusing <00:12:32.750>them <00:12:32.950>all <00:12:33.150>the <00:12:33.350>time.

189
00:12:36.370 --> 00:12:38.020
<00:12:36.370>Virtual <00:12:36.650>threats <00:12:36.930>on <00:12:37.210>the <00:12:37.490>other <00:12:37.770>end,

190
00:12:38.690 --> 00:12:43.060
<00:12:38.690>they <00:12:38.797>are <00:12:38.905>maintained <00:12:39.013>by <00:12:39.120>the <00:12:39.228>J <00:12:39.336>V <00:12:39.443>M <00:12:39.551>itself <00:12:39.659>by <00:12:39.766>the <00:12:39.874>J <00:12:39.982>V <00:12:40.090>M

191
00:12:43.490 --> 00:12:44.323
runtime.

192
00:12:45.080 --> 00:12:49.380
<00:12:45.080>So <00:12:45.207>the <00:12:45.334>J <00:12:45.461>V <00:12:45.589>M <00:12:45.716>takes <00:12:45.843>control <00:12:45.970>and <00:12:46.098>basically <00:12:46.225>every <00:12:46.352>platform <00:12:46.480>threat,

193
00:12:49.910 --> 00:12:52.060
<00:12:49.910>which <00:12:50.189>is <00:12:50.469>the <00:12:50.750>normal <00:12:51.030>Java <00:12:51.310>threat,

194
00:12:52.680 --> 00:12:56.460
<00:12:52.680>it <00:12:52.880>has <00:12:53.079>multiple <00:12:53.280>virtual <00:12:53.479>threats <00:12:53.680>assigned <00:12:53.880>to <00:12:54.079>it,

195
00:12:57.400 --> 00:13:00.140
<00:12:57.400>and <00:12:57.633>a <00:12:57.866>virtual <00:12:58.100>threat <00:12:58.333>just <00:12:58.566>starts <00:12:58.800>executing.

196
00:13:00.480 --> 00:13:04.860
<00:13:00.480>And <00:13:00.587>at <00:13:00.695>some <00:13:00.803>point <00:13:00.910>he'll <00:13:01.018>get <00:13:01.126>to <00:13:01.233>a <00:13:01.341>blocking <00:13:01.449>operation, <00:13:01.556>like <00:13:01.664>a <00:13:01.772>network <00:13:01.880>operation,

197
00:13:04.970 --> 00:13:07.340
<00:13:04.970>writing <00:13:05.170>to <00:13:05.370>a <00:13:05.570>file, <00:13:05.770>reading <00:13:05.970>from <00:13:06.170>a <00:13:06.370>database,

198
00:13:07.880 --> 00:13:12.700
<00:13:07.880>and <00:13:08.007>then <00:13:08.134>it'll <00:13:08.261>be <00:13:08.389>removed <00:13:08.516>from <00:13:08.643>the <00:13:08.770>threat <00:13:08.898>and <00:13:09.025>the <00:13:09.152>next <00:13:09.280>virtual

199
00:13:12.700 --> 00:13:16.020
<00:13:12.700>threat <00:13:12.875>in <00:13:13.050>line <00:13:13.225>will <00:13:13.400>be <00:13:13.575>placed <00:13:13.750>in <00:13:13.925>its, <00:13:14.100>uh,

200
00:13:16.620 --> 00:13:21.260
<00:13:16.620>position <00:13:16.760>and <00:13:16.900>start <00:13:17.040>executing <00:13:17.180>until <00:13:17.320>it <00:13:17.460>comes <00:13:17.600>to <00:13:17.740>a <00:13:17.880>blocking <00:13:18.020>operation.

201
00:13:21.920 --> 00:13:26.700
<00:13:21.920>And <00:13:22.075>this <00:13:22.231>is <00:13:22.386>so <00:13:22.542>fast <00:13:22.697>and <00:13:22.853>this <00:13:23.008>threat <00:13:23.164>switching <00:13:23.319>because

202
00:13:26.720 --> 00:13:29.820
<00:13:26.720>we <00:13:26.836>don't <00:13:26.953>need <00:13:27.070>to <00:13:27.186>contact <00:13:27.303>switch, <00:13:27.420>but <00:13:27.536>just <00:13:27.653>switch <00:13:27.770>in <00:13:27.886>a <00:13:28.003>few <00:13:28.120>threads.

203
00:13:29.930 --> 00:13:31.620
<00:13:29.930>This <00:13:30.163>is <00:13:30.396>almost <00:13:30.630>like <00:13:30.863>calling <00:13:31.096>a <00:13:31.329>method.

204
00:13:31.760 --> 00:13:35.500
<00:13:31.760>It <00:13:31.935>is <00:13:32.110>really <00:13:32.285>fast <00:13:32.460>and <00:13:32.635>it <00:13:32.810>is <00:13:32.985>really <00:13:33.160>cheap.

205
00:13:36.080 --> 00:13:37.820
<00:13:36.080>Oracle <00:13:36.546>actually <00:13:37.013>says, <00:13:37.480>well,

206
00:13:37.880 --> 00:13:42.420
<00:13:37.880>it <00:13:38.035>might <00:13:38.191>be <00:13:38.346>like <00:13:38.502>a <00:13:38.657>thousand <00:13:38.813>times <00:13:38.968>cheaper <00:13:39.124>and <00:13:39.280>quicker

207
00:13:43.040 --> 00:13:45.820
<00:13:43.040>to <00:13:43.319>do <00:13:43.599>than <00:13:43.880>with <00:13:44.160>classical <00:13:44.439>threading.

208
00:13:48.720 --> 00:13:53.540
<00:13:48.720>And <00:13:48.836>that <00:13:48.953>has <00:13:49.070>enormous <00:13:49.186>advantages <00:13:49.303>because <00:13:49.420>suddenly <00:13:49.536>where <00:13:49.653>we <00:13:49.770>used <00:13:49.886>to <00:13:50.003>think, <00:13:50.120>oh,

209
00:13:53.540 --> 00:13:55.860
<00:13:53.540>we <00:13:53.656>need <00:13:53.773>to <00:13:53.890>be <00:13:54.006>careful <00:13:54.123>with <00:13:54.240>threats <00:13:54.356>and <00:13:54.473>we <00:13:54.589>need <00:13:54.706>to <00:13:54.823>pull <00:13:54.939>them,

210
00:13:56.000 --> 00:13:58.220
<00:13:56.000>we <00:13:56.200>don't <00:13:56.400>need <00:13:56.600>to <00:13:56.800>do <00:13:57.000>that <00:13:57.200>anymore. <00:13:57.400>Actually,

211
00:13:58.220 --> 00:14:03.090
<00:13:58.220>virtual <00:13:58.347>threats <00:13:58.474>should <00:13:58.601>never <00:13:58.729>be <00:13:58.856>pulled. <00:13:58.983>So <00:13:59.110>how <00:13:59.238>do <00:13:59.365>we <00:13:59.492>use <00:13:59.620>them?

212
00:14:03.560 --> 00:14:06.730
<00:14:03.560>Well, <00:14:03.715>quite <00:14:03.871>simple. <00:14:04.026>If <00:14:04.182>we <00:14:04.337>make <00:14:04.493>a <00:14:04.648>runnable <00:14:04.804>oral <00:14:04.959>callable,

213
00:14:07.710 --> 00:14:10.850
<00:14:07.710>we <00:14:07.837>can <00:14:07.964>just <00:14:08.091>create <00:14:08.219>it. <00:14:08.346>And <00:14:08.473>then <00:14:08.600>in <00:14:08.728>the <00:14:08.855>run <00:14:08.982>method <00:14:09.110>here,

214
00:14:10.910 --> 00:14:15.370
<00:14:10.910>you <00:14:11.017>see <00:14:11.125>threat <00:14:11.233>of <00:14:11.340>virtual, <00:14:11.448>which <00:14:11.556>creates <00:14:11.663>a <00:14:11.771>virtual <00:14:11.879>threat, <00:14:11.986>pass <00:14:12.094>it <00:14:12.202>to <00:14:12.310>Runable.

215
00:14:15.670 --> 00:14:18.690
<00:14:15.670>And <00:14:15.810>if <00:14:15.949>you <00:14:16.089>would <00:14:16.229>do <00:14:16.370>the <00:14:16.510>new <00:14:16.650>method <00:14:16.790>threat <00:14:16.930>of <00:14:17.069>platform,

216
00:14:18.710 --> 00:14:20.890
<00:14:18.710>you <00:14:18.943>would <00:14:19.176>get <00:14:19.410>the <00:14:19.643>classical <00:14:19.876>platform <00:14:20.110>threat.

217
00:14:23.270 --> 00:14:24.360
<00:14:23.270>Like <00:14:23.597>we <00:14:23.924>said, <00:14:24.251>um,

218
00:14:24.360 --> 00:14:28.840
<00:14:24.360>threats <00:14:24.476>were <00:14:24.593>often <00:14:24.710>pulled <00:14:24.826>because <00:14:24.943>we <00:14:25.060>need <00:14:25.176>to <00:14:25.293>reuse <00:14:25.410>them <00:14:25.526>in, <00:14:25.643>for <00:14:25.760>instance,

219
00:14:28.840 --> 00:14:32.000
<00:14:28.840>application <00:14:29.040>servers. <00:14:29.240>So <00:14:29.440>we <00:14:29.640>had <00:14:29.840>these <00:14:30.040>executor <00:14:30.240>services.

220
00:14:33.540 --> 00:14:36.440
<00:14:33.540>If <00:14:33.680>you're <00:14:33.819>using <00:14:33.959>an <00:14:34.099>executor <00:14:34.240>service, <00:14:34.380>there's <00:14:34.520>a <00:14:34.660>new <00:14:34.800>method <00:14:34.939>there.

221
00:14:36.700 --> 00:14:40.760
<00:14:36.700>New <00:14:36.816>virtual <00:14:36.933>threat <00:14:37.050>per <00:14:37.166>task <00:14:37.283>executor. <00:14:37.400>And <00:14:37.516>that's <00:14:37.633>basically <00:14:37.750>what <00:14:37.866>it <00:14:37.983>is. <00:14:38.100>Now,

222
00:14:40.900 --> 00:14:43.560
<00:14:40.900>it <00:14:41.055>creates <00:14:41.211>for <00:14:41.366>every <00:14:41.522>task, <00:14:41.677>it <00:14:41.833>creates <00:14:41.988>a <00:14:42.144>virtual <00:14:42.300>threat,

223
00:14:43.620 --> 00:14:46.200
<00:14:43.620>but <00:14:43.760>it's <00:14:43.900>just <00:14:44.040>like <00:14:44.180>calling <00:14:44.320>a <00:14:44.460>method. <00:14:44.600>It <00:14:44.740>is <00:14:44.880>so <00:14:45.020>cheap.

224
00:14:46.380 --> 00:14:50.360
<00:14:46.380>And <00:14:46.487>actually <00:14:46.595>you <00:14:46.703>run <00:14:46.810>Pressler <00:14:46.918>from <00:14:47.026>Oracle <00:14:47.133>who <00:14:47.241>was <00:14:47.349>like <00:14:47.456>the <00:14:47.564>chief <00:14:47.672>behind <00:14:47.780>Project

225
00:14:50.640 --> 00:14:53.160
<00:14:50.640>Loom. <00:14:50.795>He <00:14:50.951>said <00:14:51.106>from, <00:14:51.262>you <00:14:51.417>know <00:14:51.573>what <00:14:51.728>we <00:14:51.884>should, <00:14:52.040>um,

226
00:14:53.660 --> 00:14:55.080
<00:14:53.660>you <00:14:53.915>should <00:14:54.171>only <00:14:54.426>use <00:14:54.682>virtual <00:14:54.938>threat.

227
00:14:55.220 --> 00:14:57.720
<00:14:55.220>You <00:14:55.420>shouldn't <00:14:55.620>think <00:14:55.820>about <00:14:56.020>hundred <00:14:56.220>threats <00:14:56.420>anymore. <00:14:56.620>Thousands.

228
00:14:57.720 --> 00:15:01.270
<00:14:57.720>You <00:14:57.875>can <00:14:58.031>easily <00:14:58.186>run <00:14:58.342>a <00:14:58.497>hundred <00:14:58.653>thousand <00:14:58.808>threats <00:14:58.964>now, <00:14:59.120>uh,

229
00:15:01.270 --> 00:15:05.670
<00:15:01.270>concurrently <00:15:01.397>in <00:15:01.524>your <00:15:01.651>system, <00:15:01.779>even <00:15:01.906>on <00:15:02.033>your <00:15:02.160>local <00:15:02.288>machines, <00:15:02.415>it <00:15:02.542>won't <00:15:02.670>break.

230
00:15:09.700 --> 00:15:14.190
<00:15:09.700>Project <00:15:09.840>Loom, <00:15:09.980>which <00:15:10.120>delivered <00:15:10.260>virtual <00:15:10.400>threats <00:15:10.540>came <00:15:10.680>with <00:15:10.820>two <00:15:10.960>other <00:15:11.100>things.

231
00:15:14.970 --> 00:15:16.750
<00:15:14.970>One <00:15:15.250>of <00:15:15.530>them <00:15:15.810>is <00:15:16.090>structured <00:15:16.370>concurrency.

232
00:15:18.010 --> 00:15:21.390
<00:15:18.010>And <00:15:18.150>that <00:15:18.290>has <00:15:18.430>all <00:15:18.569>to <00:15:18.710>do <00:15:18.850>with <00:15:18.990>dealing <00:15:19.130>with <00:15:19.270>concurrent <00:15:19.410>code.

233
00:15:21.450 --> 00:15:23.990
<00:15:21.450>If <00:15:21.590>you <00:15:21.730>have <00:15:21.870>a <00:15:22.010>threat <00:15:22.150>and <00:15:22.290>it <00:15:22.430>spawns <00:15:22.570>multiple <00:15:22.710>sub <00:15:22.850>threats,

234
00:15:24.330 --> 00:15:27.630
<00:15:24.330>how <00:15:24.457>do <00:15:24.584>you <00:15:24.711>keep <00:15:24.839>a <00:15:24.966>balance <00:15:25.093>between <00:15:25.220>the <00:15:25.348>two? <00:15:25.475>Very, <00:15:25.602>very <00:15:25.730>difficult.

235
00:15:29.590 --> 00:15:34.480
<00:15:29.590>Basically <00:15:29.730>what <00:15:29.870>now <00:15:30.010>is <00:15:30.150>introduced <00:15:30.290>is <00:15:30.430>a <00:15:30.570>structured <00:15:30.710>telescopes <00:15:30.850>with <00:15:30.990>two

236
00:15:34.800 --> 00:15:39.800
<00:15:34.800>possible <00:15:34.907>values. <00:15:35.015>You <00:15:35.123>can <00:15:35.230>have <00:15:35.338>a <00:15:35.446>shutdown <00:15:35.553>on <00:15:35.661>failure <00:15:35.769>or <00:15:35.876>a <00:15:35.984>shutdown <00:15:36.092>on <00:15:36.199>success.

237
00:15:40.100 --> 00:15:43.520
<00:15:40.100>The <00:15:40.255>shutdown <00:15:40.411>on <00:15:40.566>failure <00:15:40.722>basically <00:15:40.877>says, <00:15:41.033>okay, <00:15:41.188>from <00:15:41.344>a <00:15:41.500>customer,

238
00:15:44.120 --> 00:15:47.840
<00:15:44.120>I <00:15:44.247>wanna <00:15:44.374>retrieve <00:15:44.501>its <00:15:44.629>name, <00:15:44.756>its <00:15:44.883>its <00:15:45.010>current <00:15:45.138>orders, <00:15:45.265>it <00:15:45.392>it's <00:15:45.520>uh,

239
00:15:49.200 --> 00:15:51.400
<00:15:49.200>accounts <00:15:49.666>receivable, <00:15:50.133>accounts <00:15:50.600>payable,

240
00:15:51.620 --> 00:15:53.800
<00:15:51.620>all <00:15:51.853>that <00:15:52.086>information <00:15:52.320>I <00:15:52.553>want <00:15:52.786>that <00:15:53.020>retrieved.

241
00:15:54.900 --> 00:15:59.580
<00:15:54.900>And <00:15:55.007>I <00:15:55.115>will <00:15:55.223>do <00:15:55.330>this <00:15:55.438>by <00:15:55.546>creating <00:15:55.653>a <00:15:55.761>task <00:15:55.869>scope <00:15:55.976>and <00:15:56.084>creating <00:15:56.192>multiple <00:15:56.300>forks.

242
00:15:59.920 --> 00:16:03.100
<00:15:59.920>The <00:16:00.027>scope <00:16:00.135>join <00:16:00.243>will <00:16:00.350>start <00:16:00.458>all <00:16:00.566>the <00:16:00.673>threats <00:16:00.781>and <00:16:00.889>they <00:16:00.996>start <00:16:01.104>doing <00:16:01.212>their <00:16:01.319>work.

243
00:16:03.880 --> 00:16:06.100
<00:16:03.880>And <00:16:04.055>if <00:16:04.230>one <00:16:04.405>of <00:16:04.580>them <00:16:04.755>would <00:16:04.930>throw <00:16:05.105>an <00:16:05.280>exception,

244
00:16:08.460 --> 00:16:12.440
<00:16:08.460>the <00:16:08.615>task <00:16:08.771>scope <00:16:08.926>will <00:16:09.082>automatically <00:16:09.237>shut <00:16:09.393>down <00:16:09.548>the <00:16:09.704>other <00:16:09.860>threats.

245
00:16:13.160 --> 00:16:15.040
<00:16:13.160>Normally <00:16:13.315>there <00:16:13.471>would <00:16:13.626>be <00:16:13.782>something <00:16:13.937>you <00:16:14.093>had <00:16:14.248>to <00:16:14.404>do <00:16:14.560>yourself,

246
00:16:15.420 --> 00:16:18.280
<00:16:15.420>but <00:16:15.620>now <00:16:15.819>it'll <00:16:16.020>take <00:16:16.219>care <00:16:16.420>of <00:16:16.620>it. <00:16:16.819>And

247
00:16:19.910 --> 00:16:23.330
<00:16:19.910>if <00:16:20.010>you <00:16:20.110>get <00:16:20.209>to <00:16:20.310>the <00:16:20.410>point <00:16:20.510>of <00:16:20.610>throw <00:16:20.709>a <00:16:20.810>field, <00:16:20.910>if <00:16:21.010>there <00:16:21.110>was <00:16:21.209>an <00:16:21.310>exception,

248
00:16:23.380 --> 00:16:26.210
<00:16:23.380>it'll <00:16:23.580>rethread <00:16:23.780>the <00:16:23.980>first <00:16:24.180>exception <00:16:24.380>it <00:16:24.580>found, <00:16:24.780>again,

249
00:16:26.490 --> 00:16:30.410
<00:16:26.490>shutting <00:16:26.630>down <00:16:26.770>the <00:16:26.910>other <00:16:27.050>tasks. <00:16:27.190>And <00:16:27.330>if <00:16:27.470>there <00:16:27.610>was <00:16:27.750>no <00:16:27.890>exception,

250
00:16:30.590 --> 00:16:34.730
<00:16:30.590>you <00:16:30.697>could <00:16:30.805>just <00:16:30.913>go <00:16:31.020>on <00:16:31.128>and <00:16:31.236>know <00:16:31.343>that <00:16:31.451>all <00:16:31.559>the <00:16:31.666>results <00:16:31.774>will <00:16:31.882>be <00:16:31.990>there.

251
00:16:35.200 --> 00:16:39.490
<00:16:35.200>Then <00:16:35.327>there's <00:16:35.454>invoke <00:16:35.581>any <00:16:35.709>pattern <00:16:35.836>which <00:16:35.963>has <00:16:36.090>shut <00:16:36.218>down <00:16:36.345>on <00:16:36.472>success. <00:16:36.600>Say,

252
00:16:39.530 --> 00:16:43.010
<00:16:39.530>I <00:16:39.657>wanna <00:16:39.784>find <00:16:39.911>a <00:16:40.039>way <00:16:40.166>to, <00:16:40.293>uh, <00:16:40.420>belene <00:16:40.548>hal <00:16:40.675>Bon <00:16:40.802>hoof. <00:16:40.930>Uh,

253
00:16:43.370 --> 00:16:47.570
<00:16:43.370>I <00:16:43.477>could <00:16:43.585>do <00:16:43.693>an <00:16:43.800>a <00:16:43.908>p <00:16:44.016>I <00:16:44.123>call <00:16:44.231>on <00:16:44.339>Google <00:16:44.446>and <00:16:44.554>on <00:16:44.662>Apple <00:16:44.770>Maps

254
00:16:48.310 --> 00:16:51.970
<00:16:48.310>and <00:16:48.465>whichever <00:16:48.621>one <00:16:48.776>returns <00:16:48.932>cricket, <00:16:49.087>that's <00:16:49.243>the <00:16:49.398>one <00:16:49.554>that <00:16:49.709>wins.

255
00:16:52.320 --> 00:16:56.330
<00:16:52.320>I'll <00:16:52.436>take <00:16:52.553>that <00:16:52.670>information <00:16:52.786>and <00:16:52.903>I <00:16:53.020>will <00:16:53.136>automatically <00:16:53.253>shut <00:16:53.370>down. <00:16:53.486>The <00:16:53.603>other <00:16:53.720>one.

256
00:16:59.130 --> 00:17:04.030
<00:16:59.130>There's <00:16:59.237>a <00:16:59.345>story <00:16:59.453>on <00:16:59.560>threat <00:16:59.668>locals, <00:16:59.776>but <00:16:59.883>we <00:16:59.991>won't <00:17:00.099>have <00:17:00.206>much <00:17:00.314>time <00:17:00.422>for <00:17:00.530>that.

257
00:17:04.900 --> 00:17:09.120
<00:17:04.900>Um, <00:17:05.040>basically <00:17:05.180>threat <00:17:05.320>locals, <00:17:05.460>they've <00:17:05.600>been <00:17:05.740>in <00:17:05.880>Java <00:17:06.020>since <00:17:06.160>like <00:17:06.300>1999.

258
00:17:09.350 --> 00:17:14.120
<00:17:09.349>They <00:17:09.477>have <00:17:09.604>a <00:17:09.731>lot <00:17:09.859>of <00:17:09.986>problems <00:17:10.113>because <00:17:10.240>basically <00:17:10.368>they're <00:17:10.495>globally <00:17:10.622>mutable <00:17:10.750>variables

259
00:17:14.980 --> 00:17:16.120
<00:17:14.980>wasn't <00:17:15.321>a <00:17:15.664>brilliant <00:17:16.005>idea.

260
00:17:16.670 --> 00:17:20.320
<00:17:16.670>Project <00:17:16.845>Loom <00:17:17.020>introduces <00:17:17.195>as <00:17:17.370>a <00:17:17.545>preview <00:17:17.720>feature <00:17:17.895>scoped <00:17:18.070>values,

261
00:17:21.290 --> 00:17:24.000
<00:17:21.290>which <00:17:21.639>basically <00:17:21.990>is <00:17:22.339>that <00:17:22.690>you,

262
00:17:24.000 --> 00:17:28.560
<00:17:24.000>you're <00:17:24.200>still <00:17:24.400>giving <00:17:24.599>certain <00:17:24.800>values <00:17:25.000>to <00:17:25.200>a <00:17:25.400>function

263
00:17:28.970 --> 00:17:30.600
<00:17:28.970>other <00:17:29.436>than <00:17:29.903>via <00:17:30.370>parameter,

264
00:17:30.940 --> 00:17:35.360
<00:17:30.940>but <00:17:31.067>only <00:17:31.194>now <00:17:31.321>limited <00:17:31.449>to <00:17:31.576>this <00:17:31.703>specific <00:17:31.830>function <00:17:31.958>before <00:17:32.085>they <00:17:32.212>were <00:17:32.340>globally

265
00:17:35.530 --> 00:17:38.280
<00:17:35.530>accessible <00:17:35.810>and <00:17:36.090>now <00:17:36.370>they're <00:17:36.649>only <00:17:36.930>accessible

266
00:17:40.040 --> 00:17:43.420
<00:17:40.040>on <00:17:40.156>the <00:17:40.273>method <00:17:40.389>that <00:17:40.506>is <00:17:40.623>specified. <00:17:40.740>I've <00:17:40.856>got, <00:17:40.973>I <00:17:41.090>have <00:17:41.206>a <00:17:41.323>runable <00:17:41.440>here,

267
00:17:43.600 --> 00:17:45.420
<00:17:43.600>and <00:17:43.800>then <00:17:44.000>I <00:17:44.199>can <00:17:44.399>say, <00:17:44.600>okay, <00:17:44.800>scope <00:17:45.000>values,

268
00:17:45.680 --> 00:17:50.360
<00:17:45.680>I'm <00:17:45.796>setting <00:17:45.913>scope <00:17:46.030>C <00:17:46.146>with <00:17:46.263>scoped <00:17:46.380>users <00:17:46.496>calling <00:17:46.613>the <00:17:46.730>method <00:17:46.846>there <00:17:46.963>and <00:17:47.080>only

269
00:17:50.510 --> 00:17:53.520
<00:17:50.510>this <00:17:50.710>method <00:17:50.910>can <00:17:51.110>access <00:17:51.310>these <00:17:51.510>values. <00:17:51.710>They're <00:17:51.910>immutable.

270
00:17:53.520 --> 00:17:58.200
<00:17:53.520>So <00:17:53.613>inheritance <00:17:53.706>is <00:17:53.800>better, <00:17:53.893>but <00:17:53.986>we <00:17:54.080>need <00:17:54.173>to <00:17:54.266>move <00:17:54.360>on <00:17:54.453>to <00:17:54.546>other <00:17:54.639>things <00:17:54.733>in <00:17:54.826>Java <00:17:54.920>21.

271
00:17:58.780 --> 00:18:02.320
<00:17:58.780>So <00:17:58.980>simple <00:17:59.180>main <00:17:59.379>methods, <00:17:59.580>UNN <00:17:59.780>classes, <00:17:59.980>unnamed <00:18:00.180>variables,

272
00:18:02.960 --> 00:18:06.200
<00:18:02.960>sequences <00:18:03.135>and <00:18:03.310>string <00:18:03.485>templates. <00:18:03.660>Saving <00:18:03.835>the <00:18:04.010>best <00:18:04.185>for <00:18:04.360>lost.

273
00:18:07.420 --> 00:18:11.080
<00:18:07.420>We <00:18:07.536>all <00:18:07.653>know <00:18:07.770>this. <00:18:07.886>Public <00:18:08.003>static <00:18:08.120>void <00:18:08.236>main <00:18:08.353>and <00:18:08.470>then <00:18:08.586>string <00:18:08.703>array <00:18:08.820>arcs.

274
00:18:11.080 --> 00:18:12.960
<00:18:11.080>This <00:18:11.280>is <00:18:11.480>how <00:18:11.679>we <00:18:11.879>start <00:18:12.080>a <00:18:12.280>Java <00:18:12.480>program.

275
00:18:13.070 --> 00:18:17.220
<00:18:13.070>This <00:18:13.270>is <00:18:13.470>the <00:18:13.669>general <00:18:13.870>entry <00:18:14.070>point <00:18:14.270>apparently, <00:18:14.470>um,

276
00:18:17.360 --> 00:18:20.420
<00:18:17.360>in <00:18:17.560>university <00:18:17.760>these <00:18:17.959>days <00:18:18.159>they <00:18:18.360>learn, <00:18:18.560>um, <00:18:18.760>um,

277
00:18:20.420 --> 00:18:22.500
<00:18:20.420>something <00:18:20.886>like <00:18:21.353>Python <00:18:21.820>and,

278
00:18:22.500 --> 00:18:25.740
<00:18:22.500>and <00:18:22.607>Python <00:18:22.715>developers <00:18:22.823>get <00:18:22.930>really <00:18:23.038>confused <00:18:23.146>by <00:18:23.253>all <00:18:23.361>of <00:18:23.469>this. <00:18:23.576>So <00:18:23.684>they <00:18:23.792>thought, <00:18:23.900>oh,

279
00:18:25.880 --> 00:18:26.280
we,

280
00:18:26.280 --> 00:18:30.980
<00:18:26.280>we <00:18:26.396>should <00:18:26.513>make <00:18:26.629>it <00:18:26.746>easier <00:18:26.863>again <00:18:26.980>for <00:18:27.096>university <00:18:27.213>students <00:18:27.330>to <00:18:27.446>start <00:18:27.563>working <00:18:27.680>with

281
00:18:31.090 --> 00:18:35.950
<00:18:31.090>Java. <00:18:31.197>You <00:18:31.305>know <00:18:31.413>what <00:18:31.520>we'll <00:18:31.628>do? <00:18:31.736>We'll, <00:18:31.843>um, <00:18:31.951>we'll <00:18:32.059>leave <00:18:32.166>out <00:18:32.274>the <00:18:32.382>public <00:18:32.490>visibility.

282
00:18:36.080 --> 00:18:39.470
<00:18:36.080>Let's <00:18:36.187>just <00:18:36.295>keep <00:18:36.403>that <00:18:36.510>out <00:18:36.618>for <00:18:36.726>now. <00:18:36.833>Okay, <00:18:36.941>good, <00:18:37.049>we <00:18:37.156>can <00:18:37.264>do <00:18:37.372>that. <00:18:37.480>Um,

283
00:18:39.530 --> 00:18:42.670
<00:18:39.530>but <00:18:39.705>then <00:18:39.879>again, <00:18:40.055>hmm, <00:18:40.230>arguments, <00:18:40.405>maybe <00:18:40.580>that's <00:18:40.754>confusing <00:18:40.930>too.

284
00:18:42.770 --> 00:18:47.070
<00:18:42.770>Not <00:18:42.886>every <00:18:43.003>program <00:18:43.120>has <00:18:43.236>command <00:18:43.353>line <00:18:43.470>arguments. <00:18:43.586>We'll <00:18:43.703>leave <00:18:43.820>them <00:18:43.936>out <00:18:44.053>and <00:18:44.170>what,

285
00:18:47.070 --> 00:18:49.870
<00:18:47.070>what's <00:18:47.210>with <00:18:47.350>is <00:18:47.490>static <00:18:47.629>anyway? <00:18:47.770>What <00:18:47.909>is <00:18:48.050>static? <00:18:48.189>What <00:18:48.330>is <00:18:48.470>static?

286
00:18:49.940 --> 00:18:54.030
<00:18:49.940>What <00:18:50.067>is <00:18:50.194>non-st <00:18:50.321>static <00:18:50.449>objects? <00:18:50.576>Hmm, <00:18:50.703>confusing. <00:18:50.830>So <00:18:50.958>we <00:18:51.085>left <00:18:51.212>that <00:18:51.340>out.

287
00:18:54.170 --> 00:18:58.750
<00:18:54.170>So <00:18:54.263>now <00:18:54.356>actually <00:18:54.450>you <00:18:54.543>can <00:18:54.636>start <00:18:54.730>your <00:18:54.823>Java <00:18:54.916>program <00:18:55.010>like <00:18:55.103>this <00:18:55.196>and <00:18:55.290>any <00:18:55.383>of <00:18:55.476>the <00:18:55.570>other

288
00:18:59.220 --> 00:19:01.070
<00:18:59.220>flavors <00:18:59.570>there <00:18:59.920>are <00:19:00.270>with <00:19:00.620>probably,

289
00:19:01.070 --> 00:19:04.670
<00:19:01.070>which <00:19:01.197>static <00:19:01.324>with <00:19:01.451>parameters <00:19:01.579>without <00:19:01.706>all <00:19:01.833>of <00:19:01.960>them <00:19:02.088>will <00:19:02.215>start <00:19:02.342>your <00:19:02.470>program.

290
00:19:04.850 --> 00:19:09.710
<00:19:04.850>So <00:19:04.966>won't <00:19:05.083>be <00:19:05.199>a <00:19:05.316>problem <00:19:05.433>for <00:19:05.550>us <00:19:05.666>anymore. <00:19:05.783>Actually <00:19:05.899>it's <00:19:06.016>even <00:19:06.133>getting <00:19:06.250>simpler.

291
00:19:09.810 --> 00:19:11.190
<00:19:09.810>We <00:19:10.120>now <00:19:10.431>got <00:19:10.741>unnamed <00:19:11.052>classes.

292
00:19:11.850 --> 00:19:14.550
<00:19:11.850>The <00:19:11.990>method <00:19:12.129>before <00:19:12.270>you <00:19:12.409>still <00:19:12.550>had <00:19:12.689>to <00:19:12.830>had <00:19:12.969>some <00:19:13.110>class <00:19:13.250>hello,

293
00:19:14.610 --> 00:19:18.670
<00:19:14.610>do <00:19:14.703>Java <00:19:14.796>and <00:19:14.889>then <00:19:14.983>you <00:19:15.076>would <00:19:15.169>say <00:19:15.263>public <00:19:15.356>class, <00:19:15.449>hello <00:19:15.543>Java, <00:19:15.636>put <00:19:15.729>the <00:19:15.823>method <00:19:15.916>in. <00:19:16.010>No,

294
00:19:19.050 --> 00:19:22.990
<00:19:19.050>if <00:19:19.157>you <00:19:19.265>would <00:19:19.373>just <00:19:19.480>put <00:19:19.588>these <00:19:19.696>three <00:19:19.803>lines <00:19:19.911>now <00:19:20.019>in <00:19:20.126>a <00:19:20.234>hello <00:19:20.342>Java <00:19:20.450>class,

295
00:19:23.170 --> 00:19:24.030
<00:19:23.170>it <00:19:23.428>would <00:19:23.686>still <00:19:23.944>run.

296
00:19:24.130 --> 00:19:27.550
<00:19:24.130>It <00:19:24.270>doesn't <00:19:24.410>need <00:19:24.550>the <00:19:24.690>outer <00:19:24.830>class <00:19:24.970>anymore <00:19:25.110>that <00:19:25.250>we <00:19:25.390>always <00:19:25.530>needed.

297
00:19:28.170 --> 00:19:30.310
<00:19:28.170>So <00:19:28.370>I <00:19:28.570>guess <00:19:28.770>now <00:19:28.970>everyone <00:19:29.170>can <00:19:29.370>do <00:19:29.570>Java.

298
00:19:31.490 --> 00:19:33.670
<00:19:31.490>We <00:19:31.770>don't <00:19:32.050>only <00:19:32.330>have <00:19:32.610>unnamed <00:19:32.890>classes,

299
00:19:33.930 --> 00:19:37.030
<00:19:33.930>we <00:19:34.105>also <00:19:34.280>have <00:19:34.455>unnamed <00:19:34.630>variables <00:19:34.805>now <00:19:34.980>in <00:19:35.155>Java <00:19:35.330>21.

300
00:19:37.770 --> 00:19:41.990
<00:19:37.770>So <00:19:37.925>what <00:19:38.081>does <00:19:38.236>that <00:19:38.392>mean? <00:19:38.547>Um, <00:19:38.703>this <00:19:38.858>piece <00:19:39.014>of <00:19:39.170>code,

301
00:19:42.170 --> 00:19:46.350
<00:19:42.170>we <00:19:42.277>have <00:19:42.385>the <00:19:42.493>enhanced <00:19:42.600>follow <00:19:42.708>here <00:19:42.816>going <00:19:42.923>over <00:19:43.031>a <00:19:43.139>collection <00:19:43.246>and <00:19:43.354>every <00:19:43.462>time <00:19:43.570>we're

302
00:19:46.350 --> 00:19:49.750
<00:19:46.350>getting <00:19:46.449>some <00:19:46.550>kind <00:19:46.649>of <00:19:46.750>piece <00:19:46.850>of <00:19:46.949>fruit <00:19:47.050>here, <00:19:47.149>but <00:19:47.250>we <00:19:47.350>don't <00:19:47.449>really <00:19:47.550>care <00:19:47.649>about <00:19:47.750>it.

303
00:19:49.930 --> 00:19:52.950
<00:19:49.930>So <00:19:50.070>we <00:19:50.210>can <00:19:50.350>use <00:19:50.490>the <00:19:50.630>underscore <00:19:50.770>to <00:19:50.910>signal, <00:19:51.050>I <00:19:51.190>don't <00:19:51.330>care.

304
00:19:54.360 --> 00:19:56.380
<00:19:54.360>And <00:19:54.515>we <00:19:54.671>can <00:19:54.826>use <00:19:54.982>it <00:19:55.137>in <00:19:55.293>a <00:19:55.448>few <00:19:55.604>different <00:19:55.760>places.

305
00:19:56.960 --> 00:20:01.900
<00:19:56.960>We <00:19:57.060>can <00:19:57.160>use <00:19:57.260>it <00:19:57.360>if <00:19:57.460>we <00:19:57.560>don't <00:19:57.660>care <00:19:57.760>about <00:19:57.860>the <00:19:57.960>return <00:19:58.060>value <00:19:58.160>of <00:19:58.260>a <00:19:58.360>method.

306
00:20:02.080 --> 00:20:03.580
<00:20:02.080>Of <00:20:02.304>course <00:20:02.530>you <00:20:02.754>could <00:20:02.980>always <00:20:03.205>ignore <00:20:03.429>it,

307
00:20:03.640 --> 00:20:08.470
<00:20:03.640>but <00:20:03.873>then <00:20:04.106>maybe <00:20:04.340>something <00:20:04.573>would <00:20:04.806>complain <00:20:05.040>about

308
00:20:08.470 --> 00:20:11.470
<00:20:08.470>it. <00:20:08.703>Some, <00:20:08.936>some <00:20:09.170>some <00:20:09.403>code <00:20:09.636>inspector. <00:20:09.870>Um,

309
00:20:12.900 --> 00:20:16.720
<00:20:12.900>we <00:20:12.993>all <00:20:13.086>know <00:20:13.180>this <00:20:13.273>part, <00:20:13.366>we <00:20:13.460>catch <00:20:13.553>an <00:20:13.646>exception <00:20:13.740>in <00:20:13.833>the <00:20:13.926>next <00:20:14.020>line <00:20:14.113>will <00:20:14.206>be, <00:20:14.300>uh,

310
00:20:17.020 --> 00:20:19.480
<00:20:17.020>ignore <00:20:17.175>the <00:20:17.331>exception <00:20:17.486>of <00:20:17.642>so <00:20:17.797>in <00:20:17.953>a <00:20:18.108>comment <00:20:18.264>line, <00:20:18.420>right?

311
00:20:19.710 --> 00:20:23.360
<00:20:19.710>Well <00:20:19.817>now <00:20:19.925>you <00:20:20.033>can <00:20:20.140>actually <00:20:20.248>ignore <00:20:20.356>it <00:20:20.463>here <00:20:20.571>by <00:20:20.679>saying <00:20:20.786>underscore <00:20:20.894>to <00:20:21.002>the <00:20:21.110>variable

312
00:20:23.860 --> 00:20:26.400
<00:20:23.860>and <00:20:24.209>it'll <00:20:24.560>be <00:20:24.909>ignored. <00:20:25.260>But,

313
00:20:26.500 --> 00:20:29.000
<00:20:26.500>and <00:20:26.655>that's <00:20:26.811>the <00:20:26.966>best <00:20:27.122>part <00:20:27.277>where <00:20:27.433>you <00:20:27.588>can <00:20:27.744>use <00:20:27.900>this.

314
00:20:29.540 --> 00:20:33.760
<00:20:29.540>Before <00:20:29.627>we <00:20:29.715>saw <00:20:29.802>the <00:20:29.889>example <00:20:29.977>with <00:20:30.065>the <00:20:30.152>record <00:20:30.240>and <00:20:30.327>I <00:20:30.415>was <00:20:30.502>only <00:20:30.590>using <00:20:30.677>two <00:20:30.764>of <00:20:30.852>the <00:20:30.940>four

315
00:20:34.120 --> 00:20:38.080
<00:20:34.120>variables <00:20:34.260>of <00:20:34.399>the <00:20:34.540>record. <00:20:34.679>So <00:20:34.820>now <00:20:34.959>I <00:20:35.100>can <00:20:35.239>basically <00:20:35.379>say, <00:20:35.520>ah,

316
00:20:39.170 --> 00:20:42.130
<00:20:39.170>I <00:20:39.277>don't <00:20:39.385>care <00:20:39.493>about <00:20:39.600>the <00:20:39.708>ones <00:20:39.816>that <00:20:39.923>I'm <00:20:40.031>not <00:20:40.139>using. <00:20:40.246>Look <00:20:40.354>at <00:20:40.462>this <00:20:40.570>example.

317
00:20:42.410 --> 00:20:47.010
<00:20:42.410>I <00:20:42.487>got <00:20:42.565>a <00:20:42.643>list <00:20:42.721>of <00:20:42.798>countries <00:20:42.876>and <00:20:42.954>a <00:20:43.032>country <00:20:43.110>has <00:20:43.187>a <00:20:43.265>name <00:20:43.343>and <00:20:43.421>it <00:20:43.498>has <00:20:43.576>a <00:20:43.654>continent <00:20:43.732>and <00:20:43.810>a

318
00:20:47.040 --> 00:20:51.530
<00:20:47.040>population. <00:20:47.139>If <00:20:47.240>I <00:20:47.340>wanna <00:20:47.440>know <00:20:47.540>how <00:20:47.639>big <00:20:47.740>the <00:20:47.840>world <00:20:47.940>population <00:20:48.040>is, <00:20:48.139>I <00:20:48.240>only <00:20:48.340>need <00:20:48.440>pop.

319
00:20:51.690 --> 00:20:52.890
<00:20:51.690>I <00:20:52.050>only <00:20:52.410>need <00:20:52.770>population.

320
00:20:53.470 --> 00:20:58.090
<00:20:53.470>So <00:20:53.577>I <00:20:53.685>could <00:20:53.793>loop <00:20:53.900>over <00:20:54.008>this <00:20:54.116>code <00:20:54.223>over <00:20:54.331>over <00:20:54.439>the <00:20:54.546>countries <00:20:54.654>and <00:20:54.762>then <00:20:54.870>say,

321
00:20:58.250 --> 00:21:00.730
<00:20:58.250>I <00:20:58.390>don't <00:20:58.530>care <00:20:58.670>about <00:20:58.810>the <00:20:58.950>two <00:20:59.090>first <00:20:59.230>variables, <00:20:59.370>just <00:20:59.510>skip <00:20:59.650>them.

322
00:21:00.760 --> 00:21:04.290
<00:21:00.760>Just <00:21:00.900>give <00:21:01.040>me <00:21:01.180>the <00:21:01.320>p <00:21:01.460>from <00:21:01.600>population <00:21:01.740>and <00:21:01.879>add <00:21:02.020>them <00:21:02.160>together.

323
00:21:05.360 --> 00:21:08.370
<00:21:05.360>Like <00:21:05.500>I <00:21:05.639>said, <00:21:05.780>great <00:21:05.919>code <00:21:06.060>worked <00:21:06.199>perfectly <00:21:06.340>in <00:21:06.479>Java <00:21:06.620>20 <00:21:06.760>and,

324
00:21:08.370 --> 00:21:10.650
<00:21:08.370>and <00:21:08.570>then <00:21:08.770>21 <00:21:08.969>they <00:21:09.169>decided <00:21:09.370>to <00:21:09.570>change <00:21:09.770>it,

325
00:21:10.920 --> 00:21:15.010
<00:21:10.920>that <00:21:11.060>you <00:21:11.200>can't <00:21:11.340>use <00:21:11.480>the <00:21:11.620>enhanced <00:21:11.760>loop <00:21:11.900>with <00:21:12.040>record <00:21:12.180>deconstruction <00:21:12.320>anymore.

326
00:21:15.310 --> 00:21:18.650
<00:21:15.310>So <00:21:15.426>we <00:21:15.543>have <00:21:15.659>to <00:21:15.776>write <00:21:15.893>something <00:21:16.010>like <00:21:16.126>this, <00:21:16.243>which <00:21:16.360>is <00:21:16.476>a <00:21:16.593>bit <00:21:16.710>tricky,

327
00:21:19.390 --> 00:21:20.223
<00:21:19.390>but <00:21:19.639>it <00:21:19.889>still <00:21:20.139>works.

328
00:21:20.910 --> 00:21:25.770
<00:21:20.910>And <00:21:21.003>you <00:21:21.096>can <00:21:21.190>actually <00:21:21.283>see <00:21:21.376>a <00:21:21.470>bit <00:21:21.563>of <00:21:21.656>a <00:21:21.750>new <00:21:21.843>way <00:21:21.936>of <00:21:22.030>how <00:21:22.123>Java <00:21:22.216>is <00:21:22.310>working.

329
00:21:28.830 --> 00:21:32.350
<00:21:28.830>Sequence <00:21:29.030>collection. <00:21:29.230>Another <00:21:29.429>change, <00:21:29.629>um, <00:21:29.830>to <00:21:30.030>the <00:21:30.230>collections.

330
00:21:32.550 --> 00:21:34.190
<00:21:32.550>A <00:21:32.830>p <00:21:33.110>i <00:21:33.389>in <00:21:33.669>Java <00:21:33.950>21,

331
00:21:35.750 --> 00:21:38.370
<00:21:35.750>if <00:21:35.877>you <00:21:36.004>have <00:21:36.131>a <00:21:36.259>list <00:21:36.386>and <00:21:36.513>you <00:21:36.640>wanna <00:21:36.768>retrieve <00:21:36.895>the <00:21:37.022>first <00:21:37.150>element,

332
00:21:38.470 --> 00:21:41.570
<00:21:38.470>you <00:21:38.610>would <00:21:38.750>do <00:21:38.890>something <00:21:39.030>like, <00:21:39.170>um, <00:21:39.310>list <00:21:39.450>get <00:21:39.590>zero <00:21:39.730>still <00:21:39.870>works,

333
00:21:42.160 --> 00:21:45.890
<00:21:42.160>then <00:21:42.253>you <00:21:42.346>need <00:21:42.440>to <00:21:42.533>get <00:21:42.626>the <00:21:42.720>last <00:21:42.813>element <00:21:42.906>of <00:21:43.000>the <00:21:43.093>list. <00:21:43.186>And <00:21:43.280>then <00:21:43.373>you <00:21:43.466>would, <00:21:43.560>oh,

334
00:21:45.890 --> 00:21:49.410
<00:21:45.890>that <00:21:46.123>would <00:21:46.356>be <00:21:46.590>list <00:21:46.823>get, <00:21:47.056>list <00:21:47.290>size,

335
00:21:49.580 --> 00:21:54.150
<00:21:49.580>minus <00:21:49.720>one <00:21:49.860>tricky, <00:21:50.000>especially <00:21:50.139>if <00:21:50.280>the <00:21:50.419>list <00:21:50.560>would <00:21:50.699>be <00:21:50.840>empty. <00:21:50.980>Um,

336
00:21:54.370 --> 00:21:57.310
<00:21:54.370>so <00:21:54.525>they <00:21:54.681>thought <00:21:54.836>we <00:21:54.992>can <00:21:55.147>do <00:21:55.303>better. <00:21:55.458>So <00:21:55.614>we <00:21:55.770>did,

337
00:21:57.770 --> 00:22:01.850
<00:21:57.770>we <00:21:57.910>added <00:21:58.050>a <00:21:58.190>few <00:21:58.330>min <00:21:58.470>methods <00:21:58.610>to <00:21:58.750>the <00:21:58.889>list. <00:21:59.030>Get <00:21:59.170>first,

338
00:22:02.070 --> 00:22:04.610
<00:22:02.070>get <00:22:02.303>last <00:22:02.536>at <00:22:02.770>first, <00:22:03.003>at <00:22:03.236>last <00:22:03.470>remove,

339
00:22:04.610 --> 00:22:07.370
<00:22:04.610>first <00:22:04.843>remove <00:22:05.076>last <00:22:05.310>and <00:22:05.543>the <00:22:05.776>reverse <00:22:06.010>operation.

340
00:22:07.550 --> 00:22:09.450
<00:22:07.550>If <00:22:07.725>I <00:22:07.899>would <00:22:08.075>have <00:22:08.250>a <00:22:08.425>random <00:22:08.600>list <00:22:08.774>of <00:22:08.950>colors,

341
00:22:11.360 --> 00:22:14.170
<00:22:11.360>gold <00:22:11.534>and <00:22:11.709>I <00:22:11.885>would <00:22:12.060>use <00:22:12.235>the <00:22:12.409>reverse <00:22:12.584>on <00:22:12.760>it,

342
00:22:14.470 --> 00:22:19.210
<00:22:14.470>it <00:22:14.577>will <00:22:14.685>actually <00:22:14.793>turn <00:22:14.900>out <00:22:15.008>to <00:22:15.116>be <00:22:15.223>so, <00:22:15.331>so <00:22:15.439>let's <00:22:15.546>actually <00:22:15.654>reversing <00:22:15.762>the <00:22:15.870>order.

343
00:22:19.360 --> 00:22:23.230
<00:22:19.360>Very <00:22:19.709>simply. <00:22:20.060>Template <00:22:20.409>string <00:22:20.760>templates.

344
00:22:24.450 --> 00:22:26.800
<00:22:24.450>Every <00:22:24.800>language <00:22:25.150>has <00:22:25.500>templating, <00:22:25.850>right?

345
00:22:27.060 --> 00:22:30.240
<00:22:27.060>Or <00:22:27.235>string <00:22:27.409>interpolation <00:22:27.585>where <00:22:27.760>you <00:22:27.935>could <00:22:28.110>put <00:22:28.284>variables <00:22:28.460>in.

346
00:22:30.240 --> 00:22:34.320
<00:22:30.240>In <00:22:30.340>Java <00:22:30.440>we <00:22:30.540>had <00:22:30.640>to <00:22:30.740>do <00:22:30.840>some <00:22:30.940>print <00:22:31.040>F <00:22:31.140>or <00:22:31.240>sprint <00:22:31.340>F <00:22:31.440>or <00:22:31.540>string <00:22:31.640>format.

347
00:22:35.060 --> 00:22:38.040
<00:22:35.060>But <00:22:35.293>now <00:22:35.526>we <00:22:35.760>have <00:22:35.993>string <00:22:36.226>templates <00:22:36.460>ourselves,

348
00:22:38.580 --> 00:22:40.480
<00:22:38.580>so <00:22:38.813>we <00:22:39.046>can <00:22:39.280>use <00:22:39.513>this <00:22:39.746>line <00:22:39.980>here,

349
00:22:40.960 --> 00:22:44.080
<00:22:40.960>sdr <00:22:41.160>dot <00:22:41.360>and <00:22:41.560>the <00:22:41.760>text <00:22:41.960>and <00:22:42.160>we <00:22:42.360>can,

350
00:22:44.450 --> 00:22:48.040
<00:22:44.450>it'll <00:22:44.605>place <00:22:44.761>the <00:22:44.916>variables <00:22:45.072>defined <00:22:45.227>up <00:22:45.383>there <00:22:45.538>into <00:22:45.694>this <00:22:45.850>code

351
00:22:49.430 --> 00:22:52.010
<00:22:49.430>so <00:22:49.630>that, <00:22:49.830>um, <00:22:50.030>you <00:22:50.230>might <00:22:50.430>think, <00:22:50.630>what's <00:22:50.830>this?

352
00:22:52.290 --> 00:22:56.890
<00:22:52.290>S <00:22:52.406>t <00:22:52.523>r <00:22:52.639>that's <00:22:52.756>actually <00:22:52.873>a <00:22:52.990>string <00:22:53.106>template <00:22:53.223>variable <00:22:53.340>that <00:22:53.456>is <00:22:53.573>defined <00:22:53.690>and

353
00:22:56.960 --> 00:23:01.290
<00:22:56.960>automatically <00:22:57.160>imported <00:22:57.360>in <00:22:57.560>every <00:22:57.760>class <00:22:57.960>by <00:22:58.160>the <00:22:58.360>compiler.

354
00:23:01.290 --> 00:23:05.970
<00:23:01.290>A <00:23:01.397>bit <00:23:01.505>like <00:23:01.613>the <00:23:01.720>Java, <00:23:01.828>all <00:23:01.936>the, <00:23:02.043>the <00:23:02.151>internal <00:23:02.259>classes <00:23:02.366>like <00:23:02.474>Java <00:23:02.582>language <00:23:02.690>string.

355
00:23:07.110 --> 00:23:11.250
<00:23:07.110>If <00:23:07.203>you <00:23:07.296>wanna <00:23:07.389>do <00:23:07.483>fancy <00:23:07.576>formatting, <00:23:07.669>there's <00:23:07.763>an <00:23:07.856>F <00:23:07.949>M <00:23:08.043>T <00:23:08.136>have <00:23:08.229>to <00:23:08.323>import <00:23:08.416>it <00:23:08.510>yourself,

356
00:23:11.270 --> 00:23:15.710
<00:23:11.270>but <00:23:11.377>it <00:23:11.485>is <00:23:11.593>there, <00:23:11.700>it <00:23:11.808>still <00:23:11.916>looks <00:23:12.023>a <00:23:12.131>bit <00:23:12.239>awkward <00:23:12.346>compared <00:23:12.454>to <00:23:12.562>other <00:23:12.670>languages,

357
00:23:15.970 --> 00:23:20.750
<00:23:15.970>but <00:23:16.125>it <00:23:16.281>is <00:23:16.436>so <00:23:16.592>much <00:23:16.747>more <00:23:16.903>powerful <00:23:17.058>because <00:23:17.214>underneath <00:23:17.370>there

358
00:23:20.770 --> 00:23:23.750
<00:23:20.770>is <00:23:20.970>this <00:23:21.170>functional <00:23:21.370>interface <00:23:21.570>that <00:23:21.770>has <00:23:21.970>one <00:23:22.170>method.

359
00:23:24.290 --> 00:23:28.590
<00:23:24.290>So <00:23:24.406>this <00:23:24.523>processor <00:23:24.639>and <00:23:24.756>it <00:23:24.873>has <00:23:24.990>one <00:23:25.106>method <00:23:25.223>process <00:23:25.340>put <00:23:25.456>in <00:23:25.573>a <00:23:25.690>string

360
00:23:28.890 --> 00:23:32.310
<00:23:28.890>string <00:23:29.090>template <00:23:29.290>and <00:23:29.490>it <00:23:29.690>can <00:23:29.890>return <00:23:30.090>any <00:23:30.290>type.

361
00:23:33.210 --> 00:23:37.510
<00:23:33.210>And <00:23:33.317>this <00:23:33.425>is <00:23:33.533>really <00:23:33.640>cool <00:23:33.748>because <00:23:33.856>that <00:23:33.963>basically <00:23:34.071>means <00:23:34.179>that <00:23:34.286>if <00:23:34.394>you <00:23:34.502>wanna <00:23:34.610>build,

362
00:23:37.810 --> 00:23:42.430
<00:23:37.810>do <00:23:37.903>a <00:23:37.996>query <00:23:38.090>builder <00:23:38.183>here <00:23:38.276>where <00:23:38.370>you <00:23:38.463>put <00:23:38.556>in <00:23:38.649>a <00:23:38.743>connection <00:23:38.836>and <00:23:38.929>an <00:23:39.023>SS <00:23:39.116>Q <00:23:39.210>L

363
00:23:42.650 --> 00:23:47.040
<00:23:42.650>and <00:23:42.757>this <00:23:42.865>thing <00:23:42.973>is <00:23:43.080>doing <00:23:43.188>all <00:23:43.296>its <00:23:43.403>work <00:23:43.511>in <00:23:43.619>the <00:23:43.726>end <00:23:43.834>it <00:23:43.942>will <00:23:44.050>return

364
00:23:49.110 --> 00:23:54.110
<00:23:49.110>a <00:23:49.237>prepared <00:23:49.364>statement <00:23:49.491>and <00:23:49.619>then <00:23:49.746>your <00:23:49.873>code <00:23:50.000>could <00:23:50.128>look <00:23:50.255>something <00:23:50.382>like <00:23:50.510>this.

365
00:23:54.450 --> 00:23:59.360
<00:23:54.450>You <00:23:54.557>define <00:23:54.665>a <00:23:54.773>database <00:23:54.880>by <00:23:54.988>passing <00:23:55.096>a <00:23:55.203>connection <00:23:55.311>and <00:23:55.419>then <00:23:55.526>you <00:23:55.634>can <00:23:55.742>use <00:23:55.850>this

366
00:23:59.360 --> 00:24:01.840
<00:23:59.360>code <00:23:59.515>anywhere <00:23:59.671>where <00:23:59.826>you <00:23:59.982>just <00:24:00.137>pass <00:24:00.293>the <00:24:00.448>sq <00:24:00.604>l <00:24:00.760>in

367
00:24:05.190 --> 00:24:08.160
<00:24:05.190>nice <00:24:05.423>with, <00:24:05.656>um, <00:24:05.890>with, <00:24:06.123>with <00:24:06.356>multi-line <00:24:06.590>strings.

368
00:24:08.580 --> 00:24:12.890
<00:24:08.580>And <00:24:08.754>then <00:24:08.929>use <00:24:09.105>this <00:24:09.280>execute <00:24:09.455>query <00:24:09.629>method <00:24:09.804>on <00:24:09.980>it,

369
00:24:14.410 --> 00:24:16.800
<00:24:14.410>right? <00:24:14.585>Last <00:24:14.760>part, <00:24:14.935>three <00:24:15.110>and <00:24:15.285>a <00:24:15.460>half <00:24:15.635>minutes <00:24:15.810>left.

370
00:24:17.070 --> 00:24:19.760
<00:24:17.070>Combining <00:24:17.419>Java <00:24:17.770>and <00:24:18.120>data-oriented <00:24:18.470>programming.

371
00:24:20.460 --> 00:24:24.160
<00:24:20.460>So <00:24:20.600>data-oriented <00:24:20.740>programming <00:24:20.880>must <00:24:21.020>be <00:24:21.160>a <00:24:21.300>hot <00:24:21.440>thing <00:24:21.580>because <00:24:21.720>last <00:24:21.860>year,

372
00:24:24.680 --> 00:24:29.640
<00:24:24.680>language <00:24:24.807>architect <00:24:24.934>Brian <00:24:25.061>Gatz <00:24:25.189>wrote <00:24:25.316>an <00:24:25.443>article <00:24:25.570>about <00:24:25.698>it <00:24:25.825>on <00:24:25.952>InfoQ <00:24:26.080>and

373
00:24:30.070 --> 00:24:33.640
<00:24:30.070>then <00:24:30.270>the <00:24:30.470>Java <00:24:30.669>newscast <00:24:30.870>picked <00:24:31.070>up <00:24:31.270>in <00:24:31.470>it.

374
00:24:34.010 --> 00:24:38.120
<00:24:34.010>Gavin <00:24:34.103>Biman <00:24:34.196>gave <00:24:34.290>a <00:24:34.383>talk <00:24:34.476>at <00:24:34.570>Java <00:24:34.663>one <00:24:34.756>last <00:24:34.850>year. <00:24:34.943>So <00:24:35.036>must <00:24:35.129>much <00:24:35.223>be <00:24:35.316>a <00:24:35.410>thing.

375
00:24:38.780 --> 00:24:40.320
<00:24:38.780>And <00:24:39.057>what <00:24:39.334>is <00:24:39.611>it <00:24:39.888>all <00:24:40.166>about?

376
00:24:41.000 --> 00:24:45.640
<00:24:41.000>Separate <00:24:41.140>data <00:24:41.280>from <00:24:41.420>logic <00:24:41.560>stored <00:24:41.700>data <00:24:41.840>in <00:24:41.980>generic <00:24:42.120>data <00:24:42.260>structures <00:24:42.400>and

377
00:24:46.110 --> 00:24:50.220
<00:24:46.110>data <00:24:46.389>should <00:24:46.669>be <00:24:46.949>immutable. <00:24:47.229>So, <00:24:47.510>um,

378
00:24:51.000 --> 00:24:55.060
<00:24:51.000>we <00:24:51.107>all <00:24:51.215>know <00:24:51.323>from <00:24:51.430>Java <00:24:51.538>eight <00:24:51.646>the <00:24:51.753>optional <00:24:51.861>class, <00:24:51.969>right? <00:24:52.076>You <00:24:52.184>have <00:24:52.292>a <00:24:52.400>variable.

379
00:24:55.270 --> 00:24:57.980
<00:24:55.270>Could <00:24:55.445>be <00:24:55.620>no, <00:24:55.795>could <00:24:55.970>not <00:24:56.145>be <00:24:56.320>no. <00:24:56.495>So, <00:24:56.670>so,

380
00:24:58.040 --> 00:25:01.940
<00:24:58.040>so <00:24:58.180>let's <00:24:58.320>put <00:24:58.460>it <00:24:58.600>into <00:24:58.740>an <00:24:58.879>optional <00:24:59.020>and <00:24:59.159>find <00:24:59.300>out, <00:24:59.440>well,

381
00:25:02.720 --> 00:25:04.740
<00:25:02.720>if <00:25:03.000>we <00:25:03.280>would <00:25:03.560>redefine <00:25:03.840>that <00:25:04.120>optional,

382
00:25:05.040 --> 00:25:09.660
<00:25:05.040>we <00:25:05.139>could <00:25:05.240>also <00:25:05.340>could <00:25:05.440>have <00:25:05.540>done <00:25:05.639>it <00:25:05.740>like <00:25:05.840>this <00:25:05.940>is <00:25:06.040>we <00:25:06.139>defined <00:25:06.240>a <00:25:06.340>seals <00:25:06.440>interface

383
00:25:09.660 --> 00:25:12.580
<00:25:09.660>option <00:25:09.940>with <00:25:10.220>two <00:25:10.500>records <00:25:10.780>in <00:25:11.060>there,

384
00:25:13.130 --> 00:25:18.090
<00:25:13.130>some <00:25:13.237>and <00:25:13.345>none. <00:25:13.453>And <00:25:13.560>some <00:25:13.668>would <00:25:13.776>have <00:25:13.883>a <00:25:13.991>value, <00:25:14.099>none <00:25:14.206>wouldn't <00:25:14.314>have <00:25:14.422>a <00:25:14.530>value.

385
00:25:18.590 --> 00:25:21.190
<00:25:18.590>And <00:25:18.823>then <00:25:19.056>if <00:25:19.290>you <00:25:19.523>would <00:25:19.756>use <00:25:19.990>this,

386
00:25:22.970 --> 00:25:25.390
<00:25:22.970>you <00:25:23.436>could <00:25:23.903>write, <00:25:24.370>okay,

387
00:25:25.850 --> 00:25:28.450
<00:25:25.850>if <00:25:26.129>there's <00:25:26.409>no <00:25:26.689>command <00:25:26.969>line <00:25:27.250>argument,

388
00:25:28.720 --> 00:25:32.890
<00:25:28.720>I'll <00:25:28.836>return <00:25:28.953>ops <00:25:29.070>none <00:25:29.186>and <00:25:29.303>otherwise <00:25:29.420>I'll <00:25:29.536>take <00:25:29.653>the <00:25:29.770>first <00:25:29.886>command <00:25:30.003>line <00:25:30.120>argument

389
00:25:33.870 --> 00:25:38.650
<00:25:33.870>and <00:25:33.997>return <00:25:34.124>an <00:25:34.251>ops <00:25:34.379>sum. <00:25:34.506>And <00:25:34.633>your <00:25:34.760>code <00:25:34.888>now <00:25:35.015>knows <00:25:35.142>exactly <00:25:35.270>that.

390
00:25:38.650 --> 00:25:42.050
<00:25:38.650>There's <00:25:38.930>only <00:25:39.210>two <00:25:39.490>possible <00:25:39.770>options <00:25:40.050>ever,

391
00:25:42.310 --> 00:25:44.930
<00:25:42.310>either <00:25:42.659>Optum <00:25:43.010>or <00:25:43.360>Opt <00:25:43.710>none.

392
00:25:45.850 --> 00:25:49.270
<00:25:45.850>So <00:25:46.050>that <00:25:46.250>is <00:25:46.449>actually <00:25:46.649>quite <00:25:46.850>a <00:25:47.050>powerful <00:25:47.250>principle.

393
00:25:50.170 --> 00:25:53.790
<00:25:50.170>And <00:25:50.345>if <00:25:50.520>we <00:25:50.695>look <00:25:50.870>at <00:25:51.045>one <00:25:51.220>last <00:25:51.395>example <00:25:51.570>there,

394
00:25:55.050 --> 00:25:58.890
<00:25:55.050>say <00:25:55.250>we <00:25:55.450>have <00:25:55.649>an <00:25:55.850>interface, <00:25:56.050>um, <00:25:56.250>search <00:25:56.450>results.

395
00:25:59.310 --> 00:26:02.410
<00:25:59.310>Now <00:25:59.437>if <00:25:59.564>we <00:25:59.691>search <00:25:59.819>for <00:25:59.946>something <00:26:00.073>that <00:26:00.200>could <00:26:00.328>be <00:26:00.455>three <00:26:00.582>possible <00:26:00.710>outcomes.

396
00:26:02.670 --> 00:26:07.130
<00:26:02.670>Either <00:26:02.777>we <00:26:02.885>find <00:26:02.993>nothing <00:26:03.100>because <00:26:03.208>we <00:26:03.316>were <00:26:03.423>searching <00:26:03.531>with <00:26:03.639>the <00:26:03.746>wrong <00:26:03.854>value <00:26:03.962>or <00:26:04.070>we

397
00:26:07.730 --> 00:26:10.410
<00:26:07.730>searched <00:26:07.885>with <00:26:08.041>some <00:26:08.196>primary <00:26:08.352>key <00:26:08.507>value <00:26:08.663>and <00:26:08.818>we <00:26:08.974>found <00:26:09.130>something,

398
00:26:10.830 --> 00:26:14.450
<00:26:10.830>or <00:26:10.937>we <00:26:11.045>search <00:26:11.153>for <00:26:11.260>a <00:26:11.368>name <00:26:11.476>and <00:26:11.583>we <00:26:11.691>got <00:26:11.799>like <00:26:11.906>a <00:26:12.014>million <00:26:12.122>records <00:26:12.230>returned.

399
00:26:15.020 --> 00:26:18.970
<00:26:15.020>Three <00:26:15.253>possible <00:26:15.486>outcomes, <00:26:15.720>you <00:26:15.953>define <00:26:16.186>them <00:26:16.420>here,

400
00:26:19.550 --> 00:26:21.530
<00:26:19.550>you <00:26:19.830>always <00:26:20.110>know <00:26:20.389>in <00:26:20.669>your <00:26:20.950>application,

401
00:26:21.780 --> 00:26:24.930
<00:26:21.780>these <00:26:21.980>are <00:26:22.180>the <00:26:22.379>only <00:26:22.580>possible <00:26:22.780>values <00:26:22.980>and <00:26:23.180>options.

402
00:26:25.590 --> 00:26:28.090
<00:26:25.590>And <00:26:25.823>then <00:26:26.056>if <00:26:26.290>you <00:26:26.523>would <00:26:26.756>process <00:26:26.990>this,

403
00:26:28.270 --> 00:26:31.170
<00:26:28.270>you <00:26:28.470>would <00:26:28.670>create <00:26:28.870>some <00:26:29.070>kind <00:26:29.270>of <00:26:29.470>a <00:26:29.670>result.

404
00:26:33.040 --> 00:26:36.180
<00:26:33.040>And <00:26:33.215>then <00:26:33.389>your <00:26:33.565>code <00:26:33.740>could <00:26:33.915>simply <00:26:34.090>look <00:26:34.264>like <00:26:34.440>this,

405
00:26:36.630 --> 00:26:41.380
<00:26:36.630>where <00:26:36.785>you <00:26:36.941>actually <00:26:37.096>have <00:26:37.252>a <00:26:37.407>search <00:26:37.563>method. <00:26:37.718>And <00:26:37.874>again, <00:26:38.030>the,

406
00:26:41.860 --> 00:26:46.800
<00:26:41.860>you're <00:26:41.976>not <00:26:42.093>really <00:26:42.209>asking <00:26:42.326>for <00:26:42.443>the <00:26:42.560>values <00:26:42.676>in <00:26:42.793>the <00:26:42.909>O <00:26:43.026>P <00:26:43.143>X <00:26:43.260>return,

407
00:26:46.820 --> 00:26:49.200
<00:26:46.820>but <00:26:47.020>you're <00:26:47.220>asking <00:26:47.419>what <00:26:47.620>type <00:26:47.820>am <00:26:48.020>I <00:26:48.220>returning?

408
00:26:49.200 --> 00:26:54.200
<00:26:49.200>And <00:26:49.316>you <00:26:49.433>are <00:26:49.550>basing <00:26:49.666>basing <00:26:49.783>your <00:26:49.900>logic <00:26:50.016>in <00:26:50.133>your <00:26:50.250>code <00:26:50.366>on <00:26:50.483>those <00:26:50.600>specific

409
00:26:54.290 --> 00:26:58.480
<00:26:54.290>situations. <00:26:54.490>That <00:26:54.690>is <00:26:54.889>what <00:26:55.090>object <00:26:55.290>oriented, <00:26:55.490>uh, <00:26:55.690>sorry.

410
00:26:58.550 --> 00:27:03.000
<00:26:58.550>Data <00:26:58.705>oriented <00:26:58.861>programming <00:26:59.016>is <00:26:59.172>all <00:26:59.327>about <00:26:59.483>this <00:26:59.638>mixture <00:26:59.794>of <00:26:59.950>functional

411
00:27:03.000 --> 00:27:07.080
<00:27:03.000>programming <00:27:03.350>and <00:27:03.700>object <00:27:04.050>oriented <00:27:04.400>programming,

412
00:27:08.010 --> 00:27:12.290
<00:27:08.010>which <00:27:08.165>leaves <00:27:08.321>us <00:27:08.476>with <00:27:08.632>40 <00:27:08.787>seconds <00:27:08.943>left <00:27:09.098>and <00:27:09.254>a <00:27:09.410>summary.

413
00:27:12.590 --> 00:27:16.730
<00:27:12.590>So <00:27:12.764>data <00:27:12.939>oriented <00:27:13.115>treats <00:27:13.290>data <00:27:13.465>as <00:27:13.639>first <00:27:13.814>class <00:27:13.990>citizens,

414
00:27:17.210 --> 00:27:19.650
<00:27:17.210>suddenly <00:27:17.443>you're <00:27:17.676>deciding <00:27:17.910>on <00:27:18.143>your <00:27:18.376>data <00:27:18.610>oex,

415
00:27:19.650 --> 00:27:23.930
<00:27:19.650>you're <00:27:19.743>making <00:27:19.836>decisions <00:27:19.930>not <00:27:20.023>on <00:27:20.116>a <00:27:20.210>value <00:27:20.303>in <00:27:20.396>them, <00:27:20.490>but <00:27:20.583>on <00:27:20.676>the <00:27:20.770>data <00:27:20.863>o <00:27:20.956>PX <00:27:21.050>themselves.

416
00:27:25.280 --> 00:27:28.690
<00:27:25.280>Well <00:27:25.513>the <00:27:25.746>data <00:27:25.980>starts <00:27:26.213>driving <00:27:26.446>your <00:27:26.680>application

417
00:27:30.350 --> 00:27:35.170
<00:27:30.350>and <00:27:30.505>Java <00:27:30.661>supports <00:27:30.816>data <00:27:30.972>oriented <00:27:31.127>programming, <00:27:31.283>fire <00:27:31.438>records, <00:27:31.594>sealed <00:27:31.750>classes,

418
00:27:35.750 --> 00:27:36.930
<00:27:35.750>and <00:27:36.281>pattern <00:27:36.812>matching.

419
00:27:38.210 --> 00:27:41.480
<00:27:38.210>And <00:27:38.365>that <00:27:38.521>leaves <00:27:38.676>us <00:27:38.832>with <00:27:38.987>10 <00:27:39.143>seconds <00:27:39.298>for <00:27:39.454>this <00:27:39.610>class.

420
00:27:43.640 --> 00:27:45.960
<00:27:43.640>I <00:27:43.767>guess <00:27:43.894>that <00:27:44.021>was <00:27:44.149>it. <00:27:44.276>Thank <00:27:44.403>you <00:27:44.530>very <00:27:44.658>much <00:27:44.785>for <00:27:44.912>your <00:27:45.040>attention.