<div dir="ltr"><div class="gmail_default" style="font-family:monospace">Just realized that 4 and 5 will become dead links after my next commit. So here is a link tied to the commit.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><a href="https://github.com/davidalayachew/HowFastCanYouType/blob/e3ed9880a0927e84ebf8e5858cdcca9581186034/src/main/java/HowFastCanYouTypeModule/HowFastCanYouTypePackage/GUI.java#L151">https://github.com/davidalayachew/HowFastCanYouType/blob/e3ed9880a0927e84ebf8e5858cdcca9581186034/src/main/java/HowFastCanYouTypeModule/HowFastCanYouTypePackage/GUI.java#L151</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Aug 4, 2024 at 3:14 AM David Alayachew <<a href="mailto:davidalayachew@gmail.com">davidalayachew@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:monospace">Hello Core Libs Dev Team,</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" 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">https://mail.openjdk.org/pipermail/core-libs-dev/2024-January/117718.html</a></div><div class="gmail_default" style="font-family:monospace"><br>
</div><div class="gmail_default" 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 class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" 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 class="gmail_default" 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 class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Here we go.</div><div class="gmail_default" 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 class="gmail_default" 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 class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Thank you for your time, patience, and understanding!</div><div class="gmail_default" style="font-family:monospace">David Alayachew</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">[1] = <a href="https://adventofcode.com/2020/day/14" target="_blank">https://adventofcode.com/2020/day/14</a></div><div class="gmail_default" style="font-family:monospace">[2] = <a href="https://github.com/davidalayachew/Advent_of_Code/blob/1f054282d610af444dd27be4dfb374e10ac76db4/AOC/AOC_2020.java#L334" target="_blank">https://github.com/davidalayachew/Advent_of_Code/blob/1f054282d610af444dd27be4dfb374e10ac76db4/AOC/AOC_2020.java#L334</a></div><div class="gmail_default" style="font-family:monospace">[3] = <a href="https://github.com/davidalayachew/Advent_of_Code/blob/1f054282d610af444dd27be4dfb374e10ac76db4/AOC/AOC_2020.java#L468" target="_blank">https://github.com/davidalayachew/Advent_of_Code/blob/1f054282d610af444dd27be4dfb374e10ac76db4/AOC/AOC_2020.java#L468</a></div><div class="gmail_default" style="font-family:monospace">[4] = <a href="https://github.com/davidalayachew/HowFastCanYouType" target="_blank">https://github.com/davidalayachew/HowFastCanYouType</a></div><div class="gmail_default" style="font-family:monospace">[5] = <a href="https://github.com/davidalayachew/HowFastCanYouType/blob/main/src/main/java/HowFastCanYouTypeModule/HowFastCanYouTypePackage/GUI.java#L151" target="_blank">https://github.com/davidalayachew/HowFastCanYouType/blob/main/src/main/java/HowFastCanYouTypeModule/HowFastCanYouTypePackage/GUI.java#L151</a></div></div>
</blockquote></div>