<?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>DEV Community: Basu</title>
    <description>The latest articles on DEV Community by Basu (@bsknath).</description>
    <link>https://dev.to/bsknath</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%2F489956%2F23cc1517-361b-4061-b82b-7f3863449d35.png</url>
      <title>DEV Community: Basu</title>
      <link>https://dev.to/bsknath</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bsknath"/>
    <language>en</language>
    <item>
      <title>Why Elasticsearch Should Not Be Preferred for Writing Data</title>
      <dc:creator>Basu</dc:creator>
      <pubDate>Tue, 17 Dec 2024 18:26:18 +0000</pubDate>
      <link>https://dev.to/bsknath/why-elasticsearch-should-not-be-preferred-for-writing-data-107d</link>
      <guid>https://dev.to/bsknath/why-elasticsearch-should-not-be-preferred-for-writing-data-107d</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8h2l0ujd0xscaklp08do.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8h2l0ujd0xscaklp08do.jpg" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Elasticsearch is one of the most popular tools for searching and analyzing data. Its ability to process massive datasets and deliver near real-time search results has made it a cornerstone for applications ranging from e-commerce platforms to monitoring systems. However, when it comes to writing data, Elasticsearch falls short in several critical areas. In this article, we’ll explore the challenges of writing data to Elasticsearch, explain why it’s not ideal for write-heavy use cases, and discuss better alternatives. 📊💾🚫&lt;/p&gt;

&lt;p&gt;Understanding Elasticsearch’s Core Strength: Read-Heavy Workloads&lt;/p&gt;

&lt;p&gt;Elasticsearch is optimized for fast querying and analytics, powered by its inverted index architecture. This makes it a perfect choice for use cases where:&lt;/p&gt;

&lt;p&gt;Data is read and searched frequently.&lt;/p&gt;

&lt;p&gt;Queries involve complex filtering, aggregations, or full-text search.&lt;/p&gt;

&lt;p&gt;However, Elasticsearch was not built for heavy or continuous data writing. Its architecture and design decisions, while excellent for search, introduce inefficiencies for write-intensive applications. 🧠🔍💡&lt;/p&gt;

&lt;p&gt;Challenges of Writing Data to Elasticsearch&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;High Resource Consumption&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Indexing Overhead: Every time data is written to Elasticsearch, it goes through a series of processes:&lt;/p&gt;

&lt;p&gt;Analysis: Text fields are broken into tokens using analyzers.&lt;/p&gt;

&lt;p&gt;Inverted Index Creation: Tokens are mapped to their locations in documents.&lt;/p&gt;

&lt;p&gt;Segment Management: Data is written to immutable segments on disk.&lt;/p&gt;

&lt;p&gt;These steps consume significant CPU, memory, and disk resources. 📈🛠️🔄&lt;/p&gt;

&lt;p&gt;Write Amplification: Elasticsearch continuously creates and merges segments to optimize queries. These operations amplify disk I/O, leading to slower writes and higher infrastructure costs. 🚀📂📉&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Eventual Consistency&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Elasticsearch is eventually consistent. This means that after writing data to one node, it may take time for the data to replicate across the cluster and become available for querying.&lt;/p&gt;

&lt;p&gt;For applications requiring immediate consistency (e.g., financial transactions or inventory updates), this delay is unacceptable. ⏱️⚠️🔄&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Frequent Updates Are Costly&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Unlike traditional databases, Elasticsearch doesn’t modify existing documents directly.&lt;/p&gt;

&lt;p&gt;Instead, it marks the old document as deleted and writes a new version of the document to a new segment. This process:&lt;/p&gt;

&lt;p&gt;Consumes more disk space.&lt;/p&gt;

&lt;p&gt;Triggers reindexing and segment merges, further taxing the system. 🗂️🖋️🔄&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Limited Transactional Capabilities&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Elasticsearch does not support ACID (Atomicity, Consistency, Isolation, Durability) transactions.&lt;/p&gt;

&lt;p&gt;Concurrent writes or updates can lead to data conflicts or inconsistencies, making it unsuitable for applications requiring strict transactional guarantees. ❌🔒🔗&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Performance Degradation Under Heavy Write Load&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Write-heavy workloads can overwhelm Elasticsearch, causing cluster instability. Symptoms include:&lt;/p&gt;

&lt;p&gt;High latencies for both writes and reads.&lt;/p&gt;

&lt;p&gt;Increased memory usage leading to out-of-memory errors.&lt;/p&gt;

&lt;p&gt;Node failures and slower query performance. 🐢🔥💥&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Disk Usage Overhead&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The inverted index and additional metadata (e.g., for replicas and segments) result in significant disk usage. Frequent writes, updates, and deletes exacerbate this problem, leading to higher storage requirements and costs. 💾📉📛&lt;/p&gt;

&lt;p&gt;Example: Writing Data to Elasticsearch&lt;/p&gt;

&lt;p&gt;Scenario&lt;/p&gt;

&lt;p&gt;Imagine a real-time analytics system for tracking user interactions on a website. The system logs every page view, button click, and transaction as a separate document in Elasticsearch. With millions of interactions recorded daily, the following challenges arise: 🌐📱📊&lt;/p&gt;

&lt;p&gt;High Write Throughput:&lt;/p&gt;

&lt;p&gt;Each interaction generates a new document.&lt;/p&gt;

&lt;p&gt;Elasticsearch’s indexing process struggles to keep up, resulting in slower writes and increased resource usage.&lt;/p&gt;

&lt;p&gt;Frequent Updates:&lt;/p&gt;

&lt;p&gt;If user interactions need updates (e.g., adding session details), Elasticsearch marks the old document as deleted and writes a new version. This doubles the write effort and bloats disk usage. 📈📝📛&lt;/p&gt;

&lt;p&gt;Delayed Availability:&lt;/p&gt;

&lt;p&gt;Newly indexed data isn’t immediately available for queries due to the refresh interval (default: 1 second). For real-time applications, this delay is problematic. 🕒⚡🚫&lt;/p&gt;

&lt;p&gt;Better Alternatives for Write-Heavy Workloads&lt;/p&gt;

&lt;p&gt;If your application involves high write throughput or frequent updates, consider these alternatives: 💡🔄💼&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Relational Databases&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Examples: MySQL, PostgreSQL&lt;/p&gt;

&lt;p&gt;Advantages:&lt;/p&gt;

&lt;p&gt;ACID-compliant transactions ensure data consistency.&lt;/p&gt;

&lt;p&gt;Optimized for frequent updates and transactional writes.&lt;/p&gt;

&lt;p&gt;Use Cases: Financial systems, inventory management, and applications requiring strong consistency.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;NoSQL Databases&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Examples: MongoDB, Apache Cassandra, DynamoDB&lt;/p&gt;

&lt;p&gt;Advantages:&lt;/p&gt;

&lt;p&gt;High scalability and fault tolerance.&lt;/p&gt;

&lt;p&gt;Efficient for high write throughput.&lt;/p&gt;

&lt;p&gt;Use Cases: Real-time analytics, distributed systems, and high-availability applications.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Message Queues or Streaming Systems&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Examples: Apache Kafka, Amazon Kinesis&lt;/p&gt;

&lt;p&gt;Advantages:&lt;/p&gt;

&lt;p&gt;Handle massive write loads efficiently.&lt;/p&gt;

&lt;p&gt;Provide durability and scalability for event-driven architectures.&lt;/p&gt;

&lt;p&gt;Use Cases: Event logging, real-time data pipelines, and buffering writes before processing.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Time-Series Databases&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Examples: InfluxDB, TimescaleDB&lt;/p&gt;

&lt;p&gt;Advantages:&lt;/p&gt;

&lt;p&gt;Designed for time-series data with high write speeds.&lt;/p&gt;

&lt;p&gt;Built-in support for time-based queries and retention policies.&lt;/p&gt;

&lt;p&gt;Use Cases: IoT data, monitoring systems, and performance analytics. 📊📆🚀&lt;/p&gt;

&lt;p&gt;Optimizing Writes to Elasticsearch (If You Must)&lt;/p&gt;

&lt;p&gt;For scenarios where Elasticsearch is necessary for search and analytics but still requires frequent data writes, consider the following optimizations: 🛠️📊✨&lt;/p&gt;

&lt;p&gt;Use Bulk API:&lt;/p&gt;

&lt;p&gt;Batch multiple write operations into a single request to reduce indexing overhead.&lt;/p&gt;

&lt;p&gt;Adjust Refresh Interval:&lt;/p&gt;

&lt;p&gt;Increase the refresh interval to delay making new data searchable, reducing resource usage during writes.&lt;/p&gt;

&lt;p&gt;Shard Configuration:&lt;/p&gt;

&lt;p&gt;Optimize the number of shards and replicas to balance performance and storage.&lt;/p&gt;

&lt;p&gt;Pre-process Data:&lt;/p&gt;

&lt;p&gt;Use tools like Apache Kafka or AWS Lambda to aggregate and transform data before writing to Elasticsearch.&lt;/p&gt;

&lt;p&gt;Monitor and Scale:&lt;/p&gt;

&lt;p&gt;Use Elasticsearch’s monitoring tools to identify bottlenecks and scale resources as needed. 📊📈🖥️&lt;/p&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;Elasticsearch is an exceptional tool for search and analytics, but it is not designed to handle write-heavy workloads efficiently. Its resource-intensive indexing process, eventual consistency model, and limited transactional capabilities make it unsuitable for applications that prioritize high write throughput or frequent updates. 📈🚀❌&lt;/p&gt;

&lt;p&gt;Instead, consider using purpose-built databases and systems for writing data, and use Elasticsearch as a secondary layer for search and analytics. This approach ensures better performance, scalability, and cost-efficiency for your application. 💼💡✔️&lt;/p&gt;

&lt;p&gt;Have you faced challenges with writing data to Elasticsearch? Share your experiences in the comments! 💬📣🤔&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Records in java</title>
      <dc:creator>Basu</dc:creator>
      <pubDate>Tue, 26 Mar 2024 05:27:59 +0000</pubDate>
      <link>https://dev.to/bsknath/records-in-java-3bc9</link>
      <guid>https://dev.to/bsknath/records-in-java-3bc9</guid>
      <description>&lt;p&gt;Whenever we talk about boilerplate code in Java, there is always an argument that now IDEs are intelligent enough to generate sources. The problem comes when there is an addition in the fields. &lt;code&gt;Record&lt;/code&gt; in Java 14 solves this problem at least for the Data Classes.&lt;br&gt;
A record class in Java automatically has:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A private final field for each component of the record.&lt;/li&gt;
&lt;li&gt;A public constructor whose signature matches the record components.&lt;/li&gt;
&lt;li&gt;Public read accessor methods for each component of the record, with the same name and type as the component.&lt;/li&gt;
&lt;li&gt;Implementations of equals(), hashCode(), and toString() methods.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is an example of how to declare and use a record:&lt;br&gt;
&lt;code&gt;public record Employee(String name, int age) {}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This record class Employee has two components: name and age. You can create an instance of Employee and access its components like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Employee employee = new Employee("John Doe", 30);&lt;br&gt;
System.out.println(employee.name()); // prints "John Doe"&lt;br&gt;
System.out.println(employee.age()); // prints 30&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note that records are intended to be used as simple data carriers, so they are not suitable for every situation. If you need more complex behavior, you should use a regular class.&lt;/p&gt;

&lt;p&gt;Records in Java, while useful for creating simple data carrier classes, do have some limitations:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No Inheritance: Records cannot extend any other class, and they are implicitly final, so no other class can extend a record.
&lt;/li&gt;
&lt;li&gt;Limited Instance Variables: All instance variables must be declared in the record header, and these variables are automatically final. You cannot declare additional fields in the body of the record.
&lt;/li&gt;
&lt;li&gt;No Argument-less Constructor: Records automatically provide a constructor with arguments for all fields, but they do not provide a no-argument constructor. This can be a limitation when working with frameworks that rely on no-argument constructors.
&lt;/li&gt;
&lt;li&gt;No Mutability: Since all fields in a record are final, records are inherently immutable. This means once a record object is created, you cannot change its state.
&lt;/li&gt;
&lt;li&gt;Limited Use of Annotations: Annotations that are applicable to classes, methods, or fields may not be applicable to record components.
&lt;/li&gt;
&lt;li&gt;Limited Scope: Records are intended to be used as simple data carriers. If you need more complex behavior, such as methods that operate on the fields, you should use a regular class.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6u1e6ynr7ijq1l8t5xdg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6u1e6ynr7ijq1l8t5xdg.jpg" alt="Image description" width="736" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;few good reads - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.oracle.com/en/java/javase/17/language/records.html#GUID-6699E26F-4A9B-4393-A08B-1E47D4B2D263"&gt;https://docs.oracle.com/en/java/javase/17/language/records.html#GUID-6699E26F-4A9B-4393-A08B-1E47D4B2D263&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.baeldung.com/java-record-keyword"&gt;https://www.baeldung.com/java-record-keyword&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Records in java</title>
      <dc:creator>Basu</dc:creator>
      <pubDate>Tue, 26 Mar 2024 05:25:54 +0000</pubDate>
      <link>https://dev.to/bsknath/records-in-java-3f7f</link>
      <guid>https://dev.to/bsknath/records-in-java-3f7f</guid>
      <description>&lt;p&gt;Whenever we talk about boilerplate code in Java, there is always an argument that now IDEs are intelligent enough to generate sources. The problem comes when there is an addition in the fields. &lt;code&gt;Record&lt;/code&gt; in Java 14 solves this problem at least for the Data Classes.&lt;br&gt;
A record class in Java automatically has:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A private final field for each component of the record.&lt;/li&gt;
&lt;li&gt;A public constructor whose signature matches the record components.&lt;/li&gt;
&lt;li&gt;Public read accessor methods for each component of the record, with the same name and type as the component.&lt;/li&gt;
&lt;li&gt;Implementations of equals(), hashCode(), and toString() methods.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is an example of how to declare and use a record:&lt;br&gt;
&lt;code&gt;public record Employee(String name, int age) {}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This record class Employee has two components: name and age. You can create an instance of Employee and access its components like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Employee employee = new Employee("John Doe", 30);&lt;br&gt;
System.out.println(employee.name()); // prints "John Doe"&lt;br&gt;
System.out.println(employee.age()); // prints 30&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note that records are intended to be used as simple data carriers, so they are not suitable for every situation. If you need more complex behavior, you should use a regular class.&lt;/p&gt;

&lt;p&gt;Records in Java, while useful for creating simple data carrier classes, do have some limitations:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No Inheritance: Records cannot extend any other class, and they are implicitly final, so no other class can extend a record.
&lt;/li&gt;
&lt;li&gt;Limited Instance Variables: All instance variables must be declared in the record header, and these variables are automatically final. You cannot declare additional fields in the body of the record.
&lt;/li&gt;
&lt;li&gt;No Argument-less Constructor: Records automatically provide a constructor with arguments for all fields, but they do not provide a no-argument constructor. This can be a limitation when working with frameworks that rely on no-argument constructors.
&lt;/li&gt;
&lt;li&gt;No Mutability: Since all fields in a record are final, records are inherently immutable. This means once a record object is created, you cannot change its state.
&lt;/li&gt;
&lt;li&gt;Limited Use of Annotations: Annotations that are applicable to classes, methods, or fields may not be applicable to record components.
&lt;/li&gt;
&lt;li&gt;Limited Scope: Records are intended to be used as simple data carriers. If you need more complex behavior, such as methods that operate on the fields, you should use a regular class.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;few good reads - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.oracle.com/en/java/javase/17/language/records.html#GUID-6699E26F-4A9B-4393-A08B-1E47D4B2D263"&gt;https://docs.oracle.com/en/java/javase/17/language/records.html#GUID-6699E26F-4A9B-4393-A08B-1E47D4B2D263&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;htt
ps://&lt;a href="http://www.baeldung.com/java-record-keyword"&gt;www.baeldung.com/java-record-keyword&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>development</category>
    </item>
    <item>
      <title>Java groupingBy, Mapping, Counting</title>
      <dc:creator>Basu</dc:creator>
      <pubDate>Sun, 24 Mar 2024 09:32:22 +0000</pubDate>
      <link>https://dev.to/bsknath/java-groupingby-mapping-counting-4n34</link>
      <guid>https://dev.to/bsknath/java-groupingby-mapping-counting-4n34</guid>
      <description>&lt;p&gt;In my earlier post, we talked about various methods provided by &lt;code&gt;java.util.stream.Collectors&lt;/code&gt;.&lt;br&gt;
This post, I am going to talk about few other methods which are very powerful and useful.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4aq3ggwoyq53ceomuo5c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4aq3ggwoyq53ceomuo5c.jpg" alt="Image description" width="800" height="539"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is my previous post - &lt;br&gt;
&lt;a href="https://dev.to/bsknath/exploring-java-collectors-utilities-10ne"&gt;https://dev.to/bsknath/exploring-java-collectors-utilities-10ne&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>development</category>
    </item>
    <item>
      <title>Exploring Java Collectors utilities</title>
      <dc:creator>Basu</dc:creator>
      <pubDate>Fri, 22 Mar 2024 12:22:56 +0000</pubDate>
      <link>https://dev.to/bsknath/exploring-java-collectors-utilities-10ne</link>
      <guid>https://dev.to/bsknath/exploring-java-collectors-utilities-10ne</guid>
      <description>&lt;p&gt;In Java, the &lt;code&gt;java.util.stream.Collectors&lt;/code&gt; class provides a number of useful methods for performing reductions on streams. Here are some commonly used ones:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;toList()&lt;/code&gt;: Collects all Stream elements into a List instance.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9n62vrvhigpth8uyvtml.jpg" alt="Image description" width="800" height="562"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toList&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;toSet()&lt;/code&gt;: Collects all Stream elements into a Set instance.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmy0zr8fc5xnfk9m7cfr7.jpg" alt="Image description" width="800" height="544"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toSet&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;toMap()&lt;/code&gt;: Creates a Map instance from the Stream elements, with the first function serving as the map's keys and the second function as the values.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg59da4w6515xngip0xfv.jpg" alt="Image description" width="800" height="504"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toMap&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Function&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;identity&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="nl"&gt;String:&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;joining()&lt;/code&gt;: Concatenates all Stream elements into a String.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffll6rhvdxx5ymxf9uiqn.jpg" alt="Image description" width="800" height="553"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;joined&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;joining&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;", "&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;counting()&lt;/code&gt;: Counts the number of elements in the Stream.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcxkrm4s2et9tas4uvf0p.jpg" alt="Image description" width="800" height="600"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Long&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;counting&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;summingInt()&lt;/code&gt;, &lt;code&gt;summingLong()&lt;/code&gt;, &lt;code&gt;summingDouble()&lt;/code&gt;: Sums the Stream elements.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj02739yx0tgqx5om19lg.jpg" alt="Image description" width="800" height="635"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Integer&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;summingInt&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;Integer:&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;intValue&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;maxBy()&lt;/code&gt;, &lt;code&gt;minBy()&lt;/code&gt;: Finds the maximum or minimum Stream element according to a provided Comparator.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvb8vcye21ha90kqwmv68.jpg" alt="Image description" width="800" height="649"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Optional&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;max&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;maxBy&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Comparator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;naturalOrder&lt;/span&gt;&lt;span class="o"&gt;()));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;collectingAndThen()&lt;/code&gt;: Performs an additional finishing transformation.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94bdr9or7xxxlfz0xafe.jpg" alt="Image description" width="800" height="590"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;unmodifiableList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collectingAndThen&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toList&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="nl"&gt;Collections:&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;unmodifiableList&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;partitioningBy()&lt;/code&gt;: Partitions the Stream elements into a Map according to a Predicate.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy62u8ttumqedlv0mamuc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy62u8ttumqedlv0mamuc.jpg" alt="Image description" width="800" height="476"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Boolean&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;partitioned&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;partitioningBy&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are just a few examples. The &lt;code&gt;Collectors&lt;/code&gt; class provides many more utility methods for common tasks.&lt;/p&gt;

</description>
      <category>java</category>
      <category>java8</category>
      <category>programming</category>
      <category>coding</category>
    </item>
    <item>
      <title>Stop, think about it. Are you using the right Data Structure?</title>
      <dc:creator>Basu</dc:creator>
      <pubDate>Sat, 24 Jun 2023 04:40:19 +0000</pubDate>
      <link>https://dev.to/bsknath/stop-think-about-it-are-you-using-the-right-data-structure-580f</link>
      <guid>https://dev.to/bsknath/stop-think-about-it-are-you-using-the-right-data-structure-580f</guid>
      <description>&lt;p&gt;A very trivial thing but knowing which data structure or implementation maintains the order of insertion, allows duplicates, or does not accept null helps prevent unexpected outcomes. Had a similar first-hand experience a few months ago. 💀&lt;/p&gt;

&lt;p&gt;For example, lets take Map interface. There are three classes that implements Map in java - HashMap, LinkedHashMap and TreeMap.&lt;/p&gt;

&lt;p&gt;♨️ HashMap doesn't maintain insertion order, LinkedHashMap does, TreeMap maintains order in sorted manner.&lt;br&gt;
♨️ HashMap and LinkedHashMap allows one null key object (K,V), TreeMap doesn't (it may have multiple null values, never the keys).&lt;br&gt;
♨️ HashMap and LinkedHashMap both have O(1) insertion and search. TreeMap, has O(logN). Bonus - TreeMap is implemented using RB-Tree, HM - LinkedLists, LHM - Doubley-LL. These implementation are the reason for these TC.&lt;/p&gt;

</description>
      <category>java</category>
      <category>softwareengineering</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Coding standards that everyone must follow</title>
      <dc:creator>Basu</dc:creator>
      <pubDate>Thu, 15 Dec 2022 18:23:05 +0000</pubDate>
      <link>https://dev.to/bsknath/coding-standards-that-everyone-must-follow-207a</link>
      <guid>https://dev.to/bsknath/coding-standards-that-everyone-must-follow-207a</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First rule of coding - write clean, beautiful and elegant code&lt;/li&gt;
&lt;li&gt;Second rule of coding - write clean, beautiful and elegant code&lt;/li&gt;
&lt;li&gt;Take time and effort to keep our code clean and pleasing for everyone to read&lt;/li&gt;
&lt;li&gt;Follow these basic coding principles:&lt;/li&gt;
&lt;li&gt;KISS – Keep It Simple, Stupid&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/SOLID"&gt;SOLID Principles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Inversion_of_control"&gt;Inversion of Control&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DRY – Don’t Repeat Yourself.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it"&gt;YAGNI – You Ain’t Gonna Need It.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Law of Demeter.&lt;/li&gt;
&lt;li&gt;Follow Boy’s Scout rule – leave code better than you found it.&lt;/li&gt;
&lt;li&gt;Use “&lt;a href="https://en.wikipedia.org/wiki/Software_design_pattern"&gt;Design Patterns&lt;/a&gt;” whenever it makes sense to do it.&lt;/li&gt;
&lt;li&gt;Avoid Premature Optimization – Premature Optimization is the root of all evil (or at least most of it) in programming. It adds unnecessary complexity in code and makes it hard to maintain in the long run. Always measure, analyze and then optimize.&lt;/li&gt;
&lt;li&gt;Pay attention to all IDE generated warnings/suggestions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  General
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Favor composition over inheritance.&lt;/li&gt;
&lt;li&gt;Create abstraction that separate higher level concepts from lower level details.&lt;/li&gt;
&lt;li&gt;Variables and functions should be defined close to where they are used.&lt;/li&gt;
&lt;li&gt;When a method uses getter/setter excessively from other class, consider moving that logic to that class.&lt;/li&gt;
&lt;li&gt;Make sure all DTOs and Value Objects are immutable.&lt;/li&gt;
&lt;li&gt;Avoid magic numbers, Hungarian notations in code. Use named constant 
instead of magic numbers&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Core Java
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Leverage Java 8’s stream API as much as you can instead of processing collection/array explicitly. For simple operations see if makes sense to process the collection without using stream API. &lt;/li&gt;
&lt;li&gt;Use Lombok to generate boilerplate code. But do not overuse it to generate code that you don’t need&lt;/li&gt;
&lt;li&gt;Avoid annotations like @SneakyThrow, &lt;a class="mentioned-user" href="https://dev.to/data"&gt;@data&lt;/a&gt;, &lt;a class="mentioned-user" href="https://dev.to/synchronized"&gt;@synchronized&lt;/a&gt; from Lombok&lt;/li&gt;
&lt;li&gt;Before using @Value annotation make sure you really need all functionality provided by @Value&lt;/li&gt;
&lt;li&gt;Create new type instead of passing around complex collection types around e.g. instead of using List&amp;gt; create a type that represents that collection at higher abstraction&lt;/li&gt;
&lt;li&gt;Use enums instead of constants&lt;/li&gt;
&lt;li&gt;Investigate if there’s a reliable third-party library available before writing your own utility methods. Apache commons, Google Guava and Spring Utils are good example of third-party libraries that provides tons of useful functionality&lt;/li&gt;
&lt;li&gt;Use meaningful and explanatory name that reveals the intention of variable/class/method&lt;/li&gt;
&lt;li&gt;If name requires comment, it doesn’t reveal its intention. Consider re-naming such variables&lt;/li&gt;
&lt;li&gt;Use long and descriptive name but do not use very long variable name that it starting to look like sentence&lt;/li&gt;
&lt;li&gt;Avoid unnecessarily acronymization of variable name. A variable called “timeSheet” is much more descriptive and meaningful than “ts”&lt;/li&gt;
&lt;li&gt;Class Names – Classes and Objects should have noun or noun phrase names. E.g. TimeSheet, WorkEntry. It should not be a verb.&lt;/li&gt;
&lt;li&gt;Method Names – Method should have verb or verb phrase names. E.g. approveTimeSheet, submitWorkEntry&lt;/li&gt;
&lt;li&gt;Event Class Names - Should be verb in past tense E.g.TimeSheetSubmitted&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Comments
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Avoid comments. We should strive at writing self-explanatory code that requires minimum to no comments. Ideally, our code should not have any comments. If your code needs commenting, you might be doing something wrong&lt;/li&gt;
&lt;li&gt;Do not comment change history, user story in source code – it should go as part of your commit message. All meta-data about code like author, last modified time, US number, Defect Numbers should not be part of code&lt;/li&gt;
&lt;li&gt;Do not use Javadoc comment that says nothing more than function signature&lt;/li&gt;
&lt;li&gt;Javadoc style comments which are mainly used for documentation should be limited for library functionality&lt;/li&gt;
&lt;li&gt;Never ever comment out code. Just delete it.&lt;/li&gt;
&lt;li&gt;Comment should be used only when code cannot say for itself clearly&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Functions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Functions should be small. This applies to code blocks like if, while, switch blocks etc.&lt;/li&gt;
&lt;li&gt;Function should do one thing only&lt;/li&gt;
&lt;li&gt;If your function has more than a few arguments, see if your method has tight coupling with other classes. If you do need those arguments, try to wrap them in separate class&lt;/li&gt;
&lt;li&gt;Avoid Boolean flag as method parameter that is used as a flag to choose behavior in method&lt;/li&gt;
&lt;li&gt;Return java.util.Optional instead of "return null" from method&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tests
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make sure your tests cover all scenarios specified. &lt;/li&gt;
&lt;li&gt;Write unit test for everything that could possibly break&lt;/li&gt;
&lt;li&gt;Use IDE coverage tool to make sure you are covering all critical code path and branches&lt;/li&gt;
&lt;li&gt;Test all boundary conditions&lt;/li&gt;
&lt;li&gt;Write test (or tests) for each reported bug&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
