<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Java on David Hamp-Gonsalves</title><link>https://davidhampgonsalves.com/tags/java/</link><description>Recent content in Java on David Hamp-Gonsalves</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sun, 06 Sep 2015 00:00:00 +0000</lastBuildDate><atom:link href="https://davidhampgonsalves.com/tags/java/index.xml" rel="self" type="application/rss+xml"/><item><title>Java 8: The Good Parts</title><link>https://davidhampgonsalves.com/java-8-the-good-parts/</link><pubDate>Sun, 06 Sep 2015 00:00:00 +0000</pubDate><guid>https://davidhampgonsalves.com/java-8-the-good-parts/</guid><description>&lt;p&gt;Sometimes I feel that Java has become a second class citizen on the JVM. While it commands a huge market share and is generally blazingly fast it hasn&amp;rsquo;t progressed like Clojure, Scala and even Groovy have. Java 8 delivered on some of the long planned features and this post is to talk about my favourites.&lt;/p&gt;
&lt;h2 id="streams"&gt;Streams&lt;/h2&gt;
&lt;p&gt;Java&amp;rsquo;s Streams are monads that let you represent computations as a chain of steps. Typically they are created from a Collection and then the typical functional &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;reduce&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt;, etc functions are applied to achieve a desired transformation.&lt;/p&gt;</description></item><item><title>Failed Projects: Open Mosaic</title><link>https://davidhampgonsalves.com/failed-projects-open-mosaic/</link><pubDate>Sun, 02 Aug 2015 00:00:00 +0000</pubDate><guid>https://davidhampgonsalves.com/failed-projects-open-mosaic/</guid><description>&lt;p&gt;The goal of this project was to recreate an image as a mosaic of other images. I wanted to achieve this with a low number of tiles and not simply use images as pixels based on their colors.&lt;/p&gt;
&lt;img src="https://davidhampgonsalves.com/images/open-mosaic/sample.png" style="width\: 800px" class="center plain"/&gt;
&lt;h2 id="mistakes"&gt;Mistakes&lt;/h2&gt;
&lt;p&gt;The biggest mistake I made was to vastly underestimate the difficulty of the problem. I thought I could get good results by tuning my early histogram grid implementation and floundered. I have seen many other attempts at this project but yet to see any that produce good results.&lt;/p&gt;</description></item><item><title>Generating Identicons</title><link>https://davidhampgonsalves.com/generating-identicons/</link><pubDate>Tue, 19 Nov 2013 00:00:00 +0000</pubDate><guid>https://davidhampgonsalves.com/generating-identicons/</guid><description>&lt;p&gt;Identicons are icons that are generated from some form of user information. They usually serve to fill the gaps left by photo-less users that don&amp;rsquo;t provide a photo as unique(ish) identifiers for users.&lt;/p&gt;
&lt;p&gt;These are usually generated by hashing the chosen user data and then using that hash to flip image pixels on and off. The following code snippit is a Java implementation of this concept and generates a 5*5 pixel, horizontally symmetrical identicon much like the ones github recently &lt;a href="https://github.com/blog/1586-identicons"&gt;rolled out&lt;/a&gt;.&lt;/p&gt;</description></item></channel></rss>