This is an automated email from the ASF dual-hosted git repository.
git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-dev-site.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 321e193 2023/12/09 06:33:31: Generated dev website from
groovy-website@1cf0ba1
321e193 is described below
commit 321e193c187bd85f68a43a8ec0bdbba11457b048
Author: jenkins <[email protected]>
AuthorDate: Sat Dec 9 06:33:31 2023 +0000
2023/12/09 06:33:31: Generated dev website from groovy-website@1cf0ba1
---
blog/groovy-gatherers.html | 37 +++++++++++++++++++++++++++++--------
blog/index.html | 2 +-
2 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/blog/groovy-gatherers.html b/blog/groovy-gatherers.html
index 4986220..f4d480c 100644
--- a/blog/groovy-gatherers.html
+++ b/blog/groovy-gatherers.html
@@ -3,7 +3,7 @@
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--><head>
- <meta charset='utf-8'/><meta http-equiv='X-UA-Compatible'
content='IE=edge'/><meta name='viewport' content='width=device-width,
initial-scale=1'/><meta name='keywords' content='gatherers, jdk22, chop,
collate, inject, ginq, jep461'/><meta name='description' content='This post
looks at using Gatherers (JEP 461) with Groovy.'/><title>The Apache Groovy
programming language - Blogs - Using Gatherers with Groovy</title><link
href='../img/favicon.ico' type='image/x-ico' rel='icon'/><link r [...]
+ <meta charset='utf-8'/><meta http-equiv='X-UA-Compatible'
content='IE=edge'/><meta name='viewport' content='width=device-width,
initial-scale=1'/><meta name='keywords' content='gatherers, jdk22, chop,
collate, inject, ginq, streams, jep461'/><meta name='description' content='This
post looks at using Gatherers (JEP 461) with Groovy.'/><title>The Apache Groovy
programming language - Blogs - Using Gatherers with Groovy</title><link
href='../img/favicon.ico' type='image/x-ico' rel='icon' [...]
</head><body>
<div id='fork-me'>
<a href='https://github.com/apache/groovy'>
@@ -53,7 +53,7 @@
</ul>
</div>
</div>
- </div><div id='content' class='page-1'><div
class='row'><div class='row-fluid'><div class='col-lg-3'><ul
class='nav-sidebar'><li><a href='./'>Blog index</a></li><li class='active'><a
href='#doc'>Using Gatherers with Groovy</a></li><li><a
href='#_understanding_gatherers' class='anchor-link'>Understanding
Gatherers</a></li><li><a href='#_accessing_parts_of_a_collection'
class='anchor-link'>Accessing parts of a collection</a></li><li><a
href='#_collate' class='anchor [...]
+ </div><div id='content' class='page-1'><div
class='row'><div class='row-fluid'><div class='col-lg-3'><ul
class='nav-sidebar'><li><a href='./'>Blog index</a></li><li class='active'><a
href='#doc'>Using Gatherers with Groovy</a></li><li><a
href='#_understanding_gatherers' class='anchor-link'>Understanding
Gatherers</a></li><li><a href='#_accessing_parts_of_a_collection'
class='anchor-link'>Accessing parts of a collection</a></li><li><a
href='#_collate' class='anchor [...]
<div class="sectionbody">
<div class="paragraph">
<p>An interesting feature being previewed in JDK22 is <em>Gatherers</em>
@@ -223,8 +223,8 @@ the leftover elements, but it’s easy enough to write
our own:</p>
<div class="content">
<pre class="prettyprint highlight"><code data-lang="groovy"><T>
Gatherer<T, ?, List<T>> windowFixedTruncating(int windowSize) {
Gatherer.ofSequential(
- () -> [], //
initializer
- Gatherer.Integrator.ofGreedy { window, element, downstream -> //
integrator
+ () -> [], //
initializer
+ Gatherer.Integrator.ofGreedy { window, element, downstream -> //
integrator
window << element
if (window.size() < windowSize) return true
var result = List.copyOf(window)
@@ -324,8 +324,8 @@ assert (1..8).collate(3, 3) == [[1, 2, 3], [4, 5, 6], [7,
8]] // same as collat
<pre class="prettyprint highlight"><code data-lang="groovy"><T>
Gatherer<T, ?, List<T>> windowSlidingByStep(int windowSize, int
stepSize, boolean keepRemaining = true) {
int skip = 0
Gatherer.ofSequential(
- () -> [], //
initializer
- Gatherer.Integrator.ofGreedy { window, element, downstream -> //
integrator
+ () -> [], //
initializer
+ Gatherer.Integrator.ofGreedy { window, element, downstream -> //
integrator
if (skip) {
skip--
return true
@@ -337,7 +337,7 @@ assert (1..8).collate(3, 3) == [[1, 2, 3], [4, 5, 6], [7,
8]] // same as collat
[stepSize, windowSize].min().times { window.removeFirst() }
downstream.push(result)
},
- (window, downstream) -> { //
finisher
+ (window, downstream) -> { //
finisher
if (keepRemaining) {
while(window.size() > stepSize) {
downstream.push(List.copyOf(window))
@@ -545,7 +545,10 @@ being consumed and produced.</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="prettyprint highlight"><code data-lang="groovy">assert
(1..5).stream().gather(fold(() -> '', (string, number) -> string +
number)).findFirst().get() == '12345'</code></pre>
+<pre class="prettyprint highlight"><code data-lang="groovy">assert
(1..5).stream()
+ .gather(fold(() -> '', (string, number) -> string + number))
+ .findFirst()
+ .get() == '12345'</code></pre>
</div>
</div>
</div>
@@ -717,6 +720,24 @@ gatherer for <code>inits</code>:</p>
</div>
</div>
<div class="sect1">
+<h2 id="_further_information">Further information</h2>
+<div class="sectionbody">
+<div class="ulist">
+<ul>
+<li>
+<p><a href="https://openjdk.org/jeps/461">JEP 461: Stream Gatherers
(Preview)</a></p>
+</li>
+<li>
+<p><a href="https://nipafx.dev/inside-java-newscast-57/">Better Java Streams
with Gatherers - Inside Java Newscast #57</a></p>
+</li>
+<li>
+<p><a href="https://nipafx.dev/implementing-gatherers/">Implementing New Java
Stream Operations</a></p>
+</li>
+</ul>
+</div>
+</div>
+</div>
+<div class="sect1">
<h2 id="_conclusion">Conclusion</h2>
<div class="sectionbody">
<div class="paragraph">
diff --git a/blog/index.html b/blog/index.html
index 203b3f5..8342ccb 100644
--- a/blog/index.html
+++ b/blog/index.html
@@ -97,7 +97,7 @@
colors: am5.ColorSet.new(root, {})
}));
wc.data.setAll([
- { category: "groovy", value: 74 }, { category: "emoji", value:
6 }, { category: "set", value: 1 }, { category: "constraint programming",
value: 1 }, { category: "jacop", value: 1 }, { category: "or-tools", value: 1
}, { category: "choco", value: 1 }, { category: "jsr331", value: 1 }, {
category: "bytecode", value: 1 }, { category: "byte buddy", value: 1 }, {
category: "proguardcore", value: 1 }, { category: "asm", value: 1 }, {
category: "jvmadvent", value: 1 }, { categor [...]
+ { category: "groovy", value: 74 }, { category: "emoji", value:
6 }, { category: "set", value: 1 }, { category: "constraint programming",
value: 1 }, { category: "jacop", value: 1 }, { category: "or-tools", value: 1
}, { category: "choco", value: 1 }, { category: "jsr331", value: 1 }, {
category: "bytecode", value: 1 }, { category: "byte buddy", value: 1 }, {
category: "proguardcore", value: 1 }, { category: "asm", value: 1 }, {
category: "jvmadvent", value: 1 }, { categor [...]
]);
wc.labels.template.setAll({
paddingTop: 5,