<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Lambda on Devops Monk</title><link>https://devops-monk.com/tags/lambda/</link><description>Recent content in Lambda on Devops Monk</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 04 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://devops-monk.com/tags/lambda/index.xml" rel="self" type="application/rss+xml"/><item><title>Java 8 Best Practices and Patterns for Production Code</title><link>https://devops-monk.com/tutorials/java8/java8-best-practices/</link><pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/java8/java8-best-practices/</guid><description>Streams Best Practices Do: Use streams for transformations and aggregations // Good: filter → transform → collect List&amp;lt;String&amp;gt; premiumNames = customers.stream() .filter(Customer::isPremium) .map(Customer::getName) .sorted() .collect(Collectors.toList()); // Good: aggregation Map&amp;lt;String, Long&amp;gt; countByCity = customers.stream() .collect(Collectors.groupingBy(Customer::getCity, Collectors.counting())); Don&amp;rsquo;t: Use streams for simple indexed iteration // Bad: stream for something a loop does more clearly IntStream.range(0, list.size()) .forEach(i -&amp;gt; System.out.println(i + &amp;#34;: &amp;#34; + list.get(i))); // Good: traditional loop wins here for (int i = 0; i &amp;lt; list.</description></item><item><title>Lambda Expressions (JEP 126): Syntax, Closures, and Target Typing</title><link>https://devops-monk.com/tutorials/java8/lambdas/</link><pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/java8/lambdas/</guid><description>The Problem Lambdas Solve Before Java 8, passing behaviour as a value required an anonymous inner class:
// Java 7: sort a list of strings by length Collections.sort(names, new Comparator&amp;lt;String&amp;gt;() { @Override public int compare(String a, String b) { return Integer.compare(a.length(), b.length()); } }); // Run in a new thread new Thread(new Runnable() { @Override public void run() { System.out.println(&amp;#34;Hello from thread&amp;#34;); } }).start(); This works, but the boilerplate-to-intent ratio is terrible.</description></item><item><title>Method References: Four Kinds and When to Use Each</title><link>https://devops-monk.com/tutorials/java8/method-references/</link><pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/java8/method-references/</guid><description>What Are Method References? A method reference is a compact syntax for a lambda expression that does nothing except call an existing method. If a lambda&amp;rsquo;s entire body is a method call, a method reference is almost always clearer.
// Lambda names.forEach(s -&amp;gt; System.out.println(s)); // Method reference — identical behaviour, fewer characters, clearer intent names.forEach(System.out::println); The :: operator is the method reference operator. It does not call the method — it creates a reference to it, which the compiler wraps into a lambda that calls the method.</description></item></channel></rss>