<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: jklingsporn</title>
    <description>The latest articles on Forem by jklingsporn (@jklingsporn).</description>
    <link>https://forem.com/jklingsporn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F44910%2F5e18ffc2-b6fa-41f6-b0fd-24e838a37a61.jpeg</url>
      <title>Forem: jklingsporn</title>
      <link>https://forem.com/jklingsporn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jklingsporn"/>
    <language>en</language>
    <item>
      <title>Complete a Stream of CompletableFutures</title>
      <dc:creator>jklingsporn</dc:creator>
      <pubDate>Thu, 16 Nov 2017 18:56:45 +0000</pubDate>
      <link>https://forem.com/jklingsporn/complete-a-stream-of-completablefutures-3c3</link>
      <guid>https://forem.com/jklingsporn/complete-a-stream-of-completablefutures-3c3</guid>
      <description>&lt;p&gt;Sometimes I find myself in the situation where I have to perform some asynchronous tasks and perform another asynchronous task when all those tasks have been completed. As always in such situations, I’ve searched &lt;a href="https://stackoverflow.com/questions/30025428/listfuture-to-futurelist-sequence"&gt;stackoverflow&lt;/a&gt; for a how-to and the top rated answer suggests the following solution:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;That solution totally works and it is good. However, if you often deal with &lt;code&gt;Streams&lt;/code&gt;, a more functional approach would be neat. So I started coding a &lt;code&gt;Collector&lt;/code&gt; that does this operation for me in one go. I won’t go into detail of how a &lt;code&gt;Collector&lt;/code&gt; works, but this &lt;a href="http://www.nurkiewicz.com/2014/07/introduction-to-writing-custom.html"&gt;blog-post&lt;/a&gt; helped me out a lot understanding it.&lt;/p&gt;

&lt;p&gt;Finally I ended up with this solution, which I’ve uploaded to &lt;a href="https://gist.github.com/jklingsporn/f82b5248f33e0f23a15e33af1429dce3"&gt;github&lt;/a&gt;:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;And here is how you would use it:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Happy coding!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Obviously it was late yesterday D: The solution I posted was hidden in another answer with less upvotes. It suggest using &lt;code&gt;Collectors.collectAndThen&lt;/code&gt; together with the sequence-method above. In my opinion this is cleaner than following my approach with writing the &lt;code&gt;Collector&lt;/code&gt; on your own (DRY-principle). The final solution is posted below and it contains another &lt;code&gt;Collector&lt;/code&gt;-factory method that can be used if you’re not interested in the results or the &lt;code&gt;CompletableFutures&lt;/code&gt; to collect are of type &lt;code&gt;Void&lt;/code&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;a href="http://feeds.wordpress.com/1.0/gocomments/jensonjava.wordpress.com/1121/"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QaE82YOS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://feeds.wordpress.com/1.0/comments/jensonjava.wordpress.com/1121/" alt=""&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ljz7jUku--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://pixel.wp.com/b.gif%3Fhost%3Djensonjava.wordpress.com%26blog%3D28976806%26post%3D1121%26subd%3Djensonjava%26ref%3D%26feed%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ljz7jUku--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://pixel.wp.com/b.gif%3Fhost%3Djensonjava.wordpress.com%26blog%3D28976806%26post%3D1121%26subd%3Djensonjava%26ref%3D%26feed%3D1" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>stream</category>
    </item>
    <item>
      <title>vertx-jooq 2.4 released</title>
      <dc:creator>jklingsporn</dc:creator>
      <pubDate>Tue, 14 Nov 2017 09:27:19 +0000</pubDate>
      <link>https://forem.com/jklingsporn/vertx-jooq-24-released-c60</link>
      <guid>https://forem.com/jklingsporn/vertx-jooq-24-released-c60</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Note: Unfortunately, the dependencies to rxjava1 haven’t been removed completely in 2.4.0. RX users please checkout version 2.4.1.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I’m happy to announce the release of &lt;a href="https://github.com/jklingsporn/vertx-jooq/releases/tag/v2.4.1" rel="noopener noreferrer"&gt;vertx-jooq 2.4&lt;/a&gt;. The main driver behind this release was the dependency upgrade to &lt;a href="http://vertx.io/blog/vert-x-3-5-0-released/" rel="noopener noreferrer"&gt;vertx 3.5&lt;/a&gt; and thus the change of the rx-dependency in vertx-jooq-rx from rxjava to rxjava2. In addition, the JSON key names of the generated POJO are now the same as their database counterparts. This change has been announced &lt;a href="https://github.com/jklingsporn/vertx-jooq/issues/23" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Last but not least, a &lt;a href="https://github.com/jklingsporn/vertx-jooq/issues/24" rel="noopener noreferrer"&gt;bug&lt;/a&gt; has been fixed when dealing with &lt;code&gt;JsonObjectConverter&lt;/code&gt; or &lt;code&gt;JsonArrayConverter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feeds.wordpress.com/1.0/gocomments/jensonjava.wordpress.com/1106/" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Ffeeds.wordpress.com%2F1.0%2Fcomments%2Fjensonjava.wordpress.com%2F1106%2F"&gt;&lt;/a&gt; &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpixel.wp.com%2Fb.gif%3Fhost%3Djensonjava.wordpress.com%26blog%3D28976806%26post%3D1106%26subd%3Djensonjava%26ref%3D%26feed%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpixel.wp.com%2Fb.gif%3Fhost%3Djensonjava.wordpress.com%26blog%3D28976806%26post%3D1106%26subd%3Djensonjava%26ref%3D%26feed%3D1"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>uncategorized</category>
      <category>java</category>
      <category>jooq</category>
      <category>vertx</category>
    </item>
  </channel>
</rss>
