<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
All input/feedback is welcome! ðŸ™‚</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature" style="color: inherit;">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cheers,<br>
√</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b><br>
</b></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>Viktor Klang</b></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Software Architect, Java Platform Group<br>
Oracle</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> David Alayachew <davidalayachew@gmail.com><br>
<b>Sent:</b> Tuesday, 6 August 2024 23:21<br>
<b>To:</b> Viktor Klang <viktor.klang@oracle.com><br>
<b>Cc:</b> core-libs-dev <core-libs-dev@openjdk.org>; Remi Forax <forax@univ-mlv.fr><br>
<b>Subject:</b> Re: [External] : Gatherers -- windowBy</font>
<div> </div>
</div>
<div>
<div dir="auto">Thanks. I am going to use it a lot more. If I get more examples, should I post a follow up? Or leave it for others to jump in?</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Mon, Aug 5, 2024, 7:26 AM Viktor Klang <<a href="mailto:viktor.klang@oracle.com">viktor.klang@oracle.com</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi David,<br>
<br>
Thank you for the write-up<span style="display:inline-block; color:inherit; background-color:inherit"><span id="x_m_209323338929069570hyphen1">—</span></span>sharing your experience with us.</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I'm happy you've had much success with `windowBy`, and we're going to have to wait and see what other feedback on Gatherers and potential unmet needs in the roster of baked-in Gatherers.</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Gatherers is scheduled to have a second preview in Java 23, in order to give users a chance to try it out and share their experience.</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div id="x_m_209323338929069570Signature" style="color:inherit">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Cheers,<br>
√</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<b><br>
</b></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<b>Viktor Klang</b></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Software Architect, Java Platform Group<br>
Oracle</div>
</div>
<div id="x_m_209323338929069570appendonsend"></div>
<hr style="display:inline-block; width:98%">
<div id="x_m_209323338929069570divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> David Alayachew <<a href="mailto:davidalayachew@gmail.com" target="_blank" rel="noreferrer">davidalayachew@gmail.com</a>><br>
<b>Sent:</b> Sunday, 4 August 2024 09:14<br>
<b>To:</b> core-libs-dev <<a href="mailto:core-libs-dev@openjdk.org" target="_blank" rel="noreferrer">core-libs-dev@openjdk.org</a>><br>
<b>Cc:</b> Remi Forax <<a href="mailto:forax@univ-mlv.fr" target="_blank" rel="noreferrer">forax@univ-mlv.fr</a>>; Viktor Klang <<a href="mailto:viktor.klang@oracle.com" target="_blank" rel="noreferrer">viktor.klang@oracle.com</a>><br>
<b>Subject:</b> [External] : Gatherers -- windowBy</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div style="font-family:monospace">Hello Core Libs Dev Team,</div>
<div style="font-family:monospace"><br>
</div>
<div style="font-family:monospace">Apologies for the massive delay. I have been juggling many severe personal emergencies, and thus, did not have time or strength to follow up on the previous thread --
<a href="https://mail.openjdk.org/pipermail/core-libs-dev/2024-January/117718.html" target="_blank" rel="noreferrer">
https://mail.openjdk.org/pipermail/core-libs-dev/2024-January/117718.html</a></div>
<div style="font-family:monospace"><br>
</div>
<div style="font-family:monospace">As mentioned in my previous thread, I have been extremely happy with the new Gatherers API, and have found numerous uses for it.</div>
<div style="font-family:monospace"><br>
</div>
<div style="font-family:monospace">I did want to add one addition to the list of premade gatherers provided by the standard library in java.util.stream.Gatherers API -- a windowBy gatherer.</div>
<br>
<div style="font-family:monospace">The result of the thread was that, while the feature had nothing wrong with it, evidence needed to be provided of its utility. This email is that evidence. Specifically, this email is providing all of the situations where
 I used this windowBy Gatherer that Viktor Klang made for me, with the hope that it is strong enough evidence to push this method into the Gatherers API.</div>
<div style="font-family:monospace"><br>
</div>
<div style="font-family:monospace">Here we go.</div>
<div style="font-family:monospace">
<ol>
<li>Advent of Code 2020 -- Day 14 [1] -- and here is my code [2] -- here is a link to the line that actually used the gatherer [3]<br>
</li><ol>
<li>This cleaned up my solution CONSIDERABLY. If I was doing this with for loops, I would have to do index manipulation to jump ahead my for loop index wise. Here, all I am doing is telling it how to split apart the stream. Way more clear and elegant. Which
 was critical because this AOC day was extremely difficult for me. Solution is not yet done, but making great progress.<br>
</li></ol>
<li>Service Health Analytics -- Work project, so I can't share the code</li><ol>
<li>This was a super basic use case, but long story short, I'm tracing down yet another network issue, and I wanted to know what was occurring before the network outage, to see if there was a correlation. I ended up scrapping this solution in favor of another
 one, but I was quite happy with how easy the Gatherer made it to grab exactly what I wanted. It was just a windowBy followed by a sliding window, and then extracting some info by comparing the 2 chunks.<br>
</li></ol>
<li>Typing Metrics [4] -- here is the link to the method that uses the Gatherer [5]<br>
</li><ol>
<li>This is where I really put the Gatherer through its paces. I had some semi-complex examples, but I got them all to work out well. It made my logic simpler than the imperative equivalent, while also keeping things concise. Now, one point that caused me some
 difficulty was recognizing that the Gatherer has a surprisingly large number of edge cases. For example, when looking at the data in aggregate, you notice a pattern -- the first element of every window is the FALSE case of your predicate, while all remaining
 members of that window are the TRUE case of the predicate. However, it's very possible for the first window to be a single element TRUE case window. I think this is the first time I found a valid use for the Stream::dropWhile method lol. But otherwise, this
 feature REALLY helped me move forward, and I am very happy with it!</li></ol>
</ol>
<div>My biggest takeaway from using this Gatherer is that, when dealing with a Stream of events that you want to get metrics of, this gatherer is going to be a critical tool in the arsenal. This Gatherer also pairs BEAUTIFULLY with slidingWindow, to where I
 feel it made sliding window even stronger. I break up my stream into chunks using the windowBy, then slide over those chunks using sliding window. I kept finding myself using this strategy to aggregate and analyze. To use an analogy, it feels almost like making
 a database view of a larger database table.<br>
</div>
<div><br>
</div>
</div>
<div style="font-family:monospace">This is my experience using the windowBy Gatherer that Viktor Klang gave me. Please let me know if there are any questions, comments, or concerns.<br>
</div>
<div style="font-family:monospace"><br>
</div>
<div style="font-family:monospace">Thank you for your time, patience, and understanding!</div>
<div style="font-family:monospace">David Alayachew</div>
<div style="font-family:monospace"><br>
</div>
<div style="font-family:monospace">[1] = <a href="https://urldefense.com/v3/__https://adventofcode.com/2020/day/14__;!!ACWV5N9M2RV99hQ!LEBjZbZKNTq2ifo9CYK0RE3c2wwJMxmUlb7ZWZ88j3Dgq50_x3z_2hX4j2GAL_hicf5s05xDzgM8__xH7_1j6kToUsc$" target="_blank" rel="noreferrer">
https://adventofcode.com/2020/day/14</a></div>
<div style="font-family:monospace">[2] = <a href="https://urldefense.com/v3/__https://github.com/davidalayachew/Advent_of_Code/blob/1f054282d610af444dd27be4dfb374e10ac76db4/AOC/AOC_2020.java*L334__;Iw!!ACWV5N9M2RV99hQ!LEBjZbZKNTq2ifo9CYK0RE3c2wwJMxmUlb7ZWZ88j3Dgq50_x3z_2hX4j2GAL_hicf5s05xDzgM8__xH7_1jakXmB9k$" target="_blank" rel="noreferrer">
https://github.com/davidalayachew/Advent_of_Code/blob/1f054282d610af444dd27be4dfb374e10ac76db4/AOC/AOC_2020.java#L334</a></div>
<div style="font-family:monospace">[3] = <a href="https://urldefense.com/v3/__https://github.com/davidalayachew/Advent_of_Code/blob/1f054282d610af444dd27be4dfb374e10ac76db4/AOC/AOC_2020.java*L468__;Iw!!ACWV5N9M2RV99hQ!LEBjZbZKNTq2ifo9CYK0RE3c2wwJMxmUlb7ZWZ88j3Dgq50_x3z_2hX4j2GAL_hicf5s05xDzgM8__xH7_1jWHufk2U$" target="_blank" rel="noreferrer">
https://github.com/davidalayachew/Advent_of_Code/blob/1f054282d610af444dd27be4dfb374e10ac76db4/AOC/AOC_2020.java#L468</a></div>
<div style="font-family:monospace">[4] = <a href="https://urldefense.com/v3/__https://github.com/davidalayachew/HowFastCanYouType__;!!ACWV5N9M2RV99hQ!LEBjZbZKNTq2ifo9CYK0RE3c2wwJMxmUlb7ZWZ88j3Dgq50_x3z_2hX4j2GAL_hicf5s05xDzgM8__xH7_1jOKot3vY$" target="_blank" rel="noreferrer">
https://github.com/davidalayachew/HowFastCanYouType</a></div>
<div style="font-family:monospace">[5] = <a href="https://urldefense.com/v3/__https://github.com/davidalayachew/HowFastCanYouType/blob/main/src/main/java/HowFastCanYouTypeModule/HowFastCanYouTypePackage/GUI.java*L151__;Iw!!ACWV5N9M2RV99hQ!LEBjZbZKNTq2ifo9CYK0RE3c2wwJMxmUlb7ZWZ88j3Dgq50_x3z_2hX4j2GAL_hicf5s05xDzgM8__xH7_1jXX46EYs$" target="_blank" rel="noreferrer">
https://github.com/davidalayachew/HowFastCanYouType/blob/main/src/main/java/HowFastCanYouTypeModule/HowFastCanYouTypePackage/GUI.java#L151</a></div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</body>
</html>