My ten-year quest for concise lambda expressions in Java

<p>I started learning Java in 1997. I thought initially Java would be a fad and that Smalltalk would emerge as the victor in the battle for object-oriented programmer productivity over C++. I was wrong. In the great object-oriented battles in the 1990s between C++ and Smalltalk, Java emerged as the victor.</p> <p>Y2K marked the end of my career as a professional Smalltalk developer. I stopped programming in Smalltalk professionally for the promise of a higher-paying career in Java. Over two decades later, this would turn out to be the best decision I ever made in my career. I miss Smalltalk, but it&rsquo;s never too far away from my keyboard.</p> <p>My journey with Java has helped me evolve as a software engineer, learner, and teacher. I know things now that if I had continued programming professionally in Smalltalk, I might have never had the opportunity to learn and share with so many other developers. My Smalltalk experience gave me a solid perspective on what Java was missing. This knowledge and experience created a great opportunity for me to become a teacher, and to learn things more deeply as a result. Teaching a Smalltalk way of thinking to thousands of Java developers globally has enabled me to achieve a higher level of appreciation for many things. I have helped many Java developers learn how to elevate their coding style so they can communicate their intent with a more expressive vocabulary. I&rsquo;ve seen quite a few developers build great things with the skills they have developed. This is everything to me.</p> <p>In the rest of this blog, I will explain how a dislike for reading and writing for loops became so acute that it led to me creating an open-source collections library (<a href="https://github.com/eclipse/eclipse-collections" rel="noopener ugc nofollow" target="_blank">Eclipse Collections</a>) for Java inspired by Smalltalk. This then set me on a quest to find a way to help Java get good syntactical support for concise lambda expressions.</p> <h1>Hold the for</h1> <p>I dislike reading for loops in application code. I see for loops as a sign that a developer failed to learn and use a higher level abstraction to communicate what they are doing with an intention revealing name. For loops are a necessity in languages like Java. With the minimal interface design approach of Java Collections, the for loop became the &ldquo;Hodor&rdquo; of developer communication. For anyone who hasn&rsquo;t heard of &ldquo;Hodor&rdquo;, he is a character in the &ldquo;Game of Thones&rdquo; series who says only one word:&nbsp;<em>Hodor!</em>&nbsp;I will refer to the style of programming where all iteration patterns are written with for loops as&nbsp;<em>Hofor!</em></p> <p><a href="https://betterprogramming.pub/my-ten-year-quest-for-concise-lambda-expressions-in-java-39fde576b950">Website</a></p>