<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Prateek Nima on Medium]]></title>
        <description><![CDATA[Stories by Prateek Nima on Medium]]></description>
        <link>https://medium.com/@prateeknima?source=rss-eab44bd82f61------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hEc9A9C56ZRBBpbxxxQ0hg.png</url>
            <title>Stories by Prateek Nima on Medium</title>
            <link>https://medium.com/@prateeknima?source=rss-eab44bd82f61------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 02:16:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prateeknima/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Testing Project Valhalla on a Real Ranked Search Use Case in Java]]></title>
            <link>https://prateeknima.medium.com/testing-project-valhalla-on-a-real-ranked-search-use-case-in-java-8b18d182f4e6?source=rss-eab44bd82f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b18d182f4e6</guid>
            <category><![CDATA[performance-optimization]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[valhalla]]></category>
            <category><![CDATA[memory-management]]></category>
            <dc:creator><![CDATA[Prateek Nima]]></dc:creator>
            <pubDate>Mon, 22 Jun 2026 06:41:00 GMT</pubDate>
            <atom:updated>2026-06-22T06:41:00.811Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rVY7uh5f7hgcORZj" /><figcaption>Photo by <a href="https://unsplash.com/@anniespratt?utm_source=medium&amp;utm_medium=referral">Annie Spratt</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Modern Java applications often spend a surprising amount of time creating short-lived objects.</p><p>In backend systems, this can show up as:</p><ul><li>allocation pressure</li><li>garbage collection activity</li><li>higher memory usage</li><li>latency instability under load</li></ul><p><strong>GitHub Project:</strong> <a href="https://github.com/prateeknima/EventAnalysisPlatform">https://github.com/prateeknima/EventAnalysisPlatform</a></p><p>In this project, I wanted to test whether Project Valhalla could help with a realistic object shape from my own application, instead of using a random synthetic example.</p><p>The application is an event-analysis platform built with:</p><ul><li>Java and Spring Boot</li><li>Kafka</li><li>PostgreSQL with jOOQ and Flyway</li><li>Redis</li><li>Elasticsearch</li><li>Debezium CDC</li><li>Keycloak/OIDC</li><li>Prometheus, Grafana, Alertmanager, and Kibana</li><li>Docker, Kubernetes manifests, GitHub Actions, and k6 load testing</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F6Va6-5rVh4WMPSA06ogZg.png" /></figure><p>The write path accepts incidents through an API, publishes events to Kafka, persists data to PostgreSQL, updates Redis status, and indexes searchable documents into Elasticsearch through a CDC-driven search indexer.</p><p>One of the newer features in the platform is ranked incident search.</p><p>The API supports a flow like this:</p><pre>GET /incidents/search/ranked?q=timeout&amp;limit=100</pre><p>The service searches Elasticsearch and then ranks matching incidents using operational metadata such as:</p><ul><li>priority score</li><li>affected service count</li><li>Elasticsearch relevance score</li></ul><p>This ranking path creates small immutable score objects. That made it a good candidate for a Project Valhalla experiment.</p><h3>What I Wanted To Test</h3><p>The question was not:</p><pre>Can Valhalla make my whole API faster?</pre><p>That would be too broad, and not a fair claim.</p><p>The actual question was smaller:</p><pre>For a compact ranked-search score object,<br>can Valhalla value records reduce allocation pressure compared with normal Java records?</pre><p>This distinction matters.</p><p>For utilising the benefits of Project Valhalla the object shape matters a lot.</p><h3>The Production Shape</h3><p>In the main application, I use a compact ranking value:</p><pre>public record IncidentRankScore(int sortKey) {<br>}</pre><p>Instead of storing ranking data as several separate fields, the score is packed into one primitive int.</p><p>The packed fields are:</p><pre>priorityScore<br>affectedServiceCount<br>searchScoreBasisPoints</pre><p>The packing logic looks like this:</p><pre>int sortKey =<br>        (safePriorityScore &lt;&lt; 24)<br>                | (safeAffectedServiceCount &lt;&lt; 16)<br>                | searchScoreBasisPoints;</pre><p>And the values are read back like this:</p><pre>public int priorityScore() {<br>    return (sortKey &gt;&gt;&gt; 24) &amp; 0x7F;<br>}</pre><pre>public int affectedServiceCount() {<br>    return (sortKey &gt;&gt;&gt; 16) &amp; 0xFF;<br>}</pre><pre>public float searchScore() {<br>    return (sortKey &amp; 0xFFFF) / 100.0f;<br>}</pre><p>This keeps the ranking object very small.</p><p>That matters because Valhalla is most interesting when the object is:</p><ul><li>small</li><li>immutable</li><li>identity-free</li><li>created many times</li><li>used in hot paths</li></ul><p>A ranked-search score fits that shape well.</p><h3>Why Compare Record vs Value Record?</h3><p>The stable Java version uses a normal record:</p><pre>record RankSignalRecord(int sortKey) {<br>}</pre><p>The Valhalla experiment uses a value record:</p><pre>value record RankSignalValueRecord(int sortKey) {<br>}</pre><p>Both versions were compiled and run using the same Valhalla early-access JDK.</p><p>That is important.</p><p>I did not compare:</p><pre>JDK 25 normal record<br>vs<br>JDK 27 value record</pre><p>That would be unfair because JVM version differences could affect the result.</p><p>Instead, the comparison was:</p><pre>JDK 27 + normal record<br>vs<br>JDK 27 + value record</pre><p>Only one thing changed:</p><pre>record -&gt; value record</pre><h3>Manual Benchmark</h3><p>I first wrote a manual benchmark.</p><p>It measures three things separately:</p><pre>allocationMs<br>scanMs<br>approxMemoryDeltaMb</pre><p>Meaning:</p><pre>allocationMs          = time to create the objects<br>scanMs                = time to loop over them and read values<br>approxMemoryDeltaMb   = rough heap usage after allocation</pre><p>I also added warmup before measurement.</p><p>That matters because the JVM needs time for:</p><ul><li>class loading</li><li>runtime profiling</li><li>JIT compilation</li><li>GC settling</li></ul><p>The manual benchmark flow is:</p><pre>warmup<br>GC<br>measured allocation<br>measured scan<br>print result</pre><p>One caveat: approxMemoryDeltaMb is a rough local measurement, not a replacement for a proper profiler. I treat it as a directional signal, not an exact memory model.</p><h3>Manual Benchmark Results</h3><h3>Production-Shaped Packed Rank Signal</h3><p>This is the benchmark shape that matches the production IncidentRankScore.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*alICQMN0vBn5IYv4tYNUrA.png" /></figure><p>The result was clear for allocation and memory:</p><ul><li>at 5M values, approximate memory dropped from 99MB to 43MB</li><li>at 10M values, approximate memory dropped from 197MB to 81MB</li><li>allocation time was also lower for the value-record version</li></ul><p>But scan time was slower for the value-record version in this manual run.</p><p>The better conclusion is:</p><pre>For this compact ranking-score shape, the Valhalla value record reduced allocation pressure and memory usage, <br>but did not improve scan/read time in the manual benchmark.</pre><h3>Earlier Non-Packed Incident Score Control</h3><p>Before switching to the packed rank signal, I also tested a larger non-packed score object.</p><p>This did not show the same improvement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7j6SrG7kf4w8IbRoF8N8og.png" /></figure><p>This control result is useful because it shows something important:</p><pre>The benefits of value records depend heavily on object shape.</pre><p>The packed ranking object was a much better candidate than the earlier larger score object.</p><h3>Why Scan Time Can Be Slower</h3><p>Less memory does not automatically mean faster reads.</p><p>There are a few possible reasons:</p><ul><li>the Valhalla JDK is still early-access</li><li>the JVM may store or access value records differently</li><li>the object is extremely small: just one int</li><li>reading one int is already very cheap</li><li>small runtime overheads can become visible in microbenchmarks</li></ul><p>The useful signal is:</p><pre>for this compact shape, allocation and memory usage improved significantly</pre><h3>Adding JMH</h3><p>After the manual benchmark, I added a JMH benchmark.</p><p>JMH is the Java Microbenchmark Harness. It is designed for JVM microbenchmarks and handles things like:</p><ul><li>warmup iterations</li><li>measurement iterations</li><li>forked JVM runs</li><li>dead-code protection</li><li>GC/allocation profiling</li></ul><p>The JMH benchmark compares the same two shapes:</p><pre>RankSignalRecord<br>RankSignalValueRecord</pre><p>It creates and scans the ranking values as one benchmark operation.</p><p>That means the manual benchmark and JMH benchmark answer slightly different questions.</p><p>The manual benchmark separates:</p><pre>allocation<br>scan<br>memory</pre><p>JMH measures:</p><pre>allocation + scan together</pre><p>So both results can be true:</p><pre>scan alone can be slower<br>total operation can still be faster because allocation and GC pressure are much lower</pre><h3>JMH Microbenchmark Results</h3><p>JMH measured the packed ranking signal only</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ppBKCjw_5_1M09lAmNZD7g.png" /></figure><p>The JMH benchmark showed a stronger result than the manual benchmark.</p><p>For this compact score shape, the value-record version:</p><ul><li>allocated much less memory</li><li>completed the combined create-and-scan operation faster</li><li>spent much less time in GC during the benchmark</li></ul><p>At 5 million values:</p><pre>normal record:       28.782ms/op, ~100MB/op allocated<br>value record:         6.464ms/op, ~40MB/op allocated</pre><p>At 10 million values:</p><pre>normal record:       57.459ms/op, ~200MB/op allocated<br>value record:        13.097ms/op, ~80MB/op allocated</pre><p>The GC profiling result was also interesting:</p><pre>5M packed record:        2854ms GC time<br>5M packed value record:    70ms GC time</pre><pre>10M packed record:       2927ms GC time<br>10M packed value record:    76ms GC time</pre><p>This does not mean the full application will see the same improvement. It means this isolated ranking-score object shape is a strong candidate for Valhalla-style optimization.</p><h3>What This Shows</h3><p>The safe conclusion is:</p><pre>For this compact ranked-search score shape,<br>Valhalla value records reduced allocation pressure in local JVM benchmarks.</pre><p>This experiment shows a useful JVM-level result.</p><p>It does not prove:</p><ul><li>the whole API is faster</li><li>Elasticsearch search latency is lower</li><li>Kafka processing is faster</li><li>production p95 latency improves</li><li>Valhalla is production-ready for this service</li><li>all object shapes will benefit</li></ul><p>Those would require end-to-end load testing and production-grade profiling.</p><p>For the actual Spring Boot service, I would still use:</p><ul><li>k6 for load testing</li><li>Prometheus/Grafana for runtime metrics</li><li>JFR/JDK Mission Control for JVM profiling</li><li>JMH for isolated JVM microbenchmarks</li></ul><p>The Valhalla benchmark is specifically about JVM-level object cost.</p><h3>Why This Is Still Production-Relevant</h3><p>Ranked search can create many short-lived ranking objects.</p><p>In a high-throughput service, that can affect:</p><ul><li>heap pressure</li><li>GC frequency</li><li>GC pause time</li><li>CPU spent allocating objects</li><li>available memory headroom</li></ul><p>Even if each object is tiny, millions of them can matter.</p><p>This experiment gives a realistic reason to track Valhalla as a future optimization path for Java services that use many small immutable value objects.</p><h3>Why I Kept It Separate</h3><p>The production Spring Boot application still uses stable Java records.</p><p>The Valhalla code is isolated under an experiment folder because it requires:</p><ul><li>early-access JDK</li><li>preview flags</li><li>separate benchmark execution</li></ul><p>I would not put this into the production runtime today.</p><p>That separation is intentional:</p><pre>production app = stable Java<br>experiment     = Valhalla EA JDK + JMH</pre><h3>Final Conclusion</h3><p>The best conclusion from this experiment is:</p><pre>Project Valhalla showed a measurable allocation and memory benefit<br>for compact ranked-search score values in this local JVM benchmark.</pre><p>More specifically:</p><pre>When the object is small, immutable, identity-free, and primitive-backed,<br>Valhalla value records can significantly reduce allocation pressure.</pre><p>That is the kind of result I would actually trust.</p><p>For now, the production application stays on stable Java records. The Valhalla code remains isolated as an experiment, but the benchmark gives a clear direction:</p><pre>future Java value objects could be valuable for hot ranking,<br>scoring, and enrichment paths in high-throughput services</pre><h3>References</h3><ul><li><a href="https://openjdk.org/projects/valhalla/">OpenJDK Project Valhalla</a></li><li><a href="https://openjdk.org/jeps/401">JEP 401: Value Classes and Objects</a></li><li><a href="https://openjdk.org/projects/code-tools/jmh/">OpenJDK JMH</a></li></ul><p>I hope you found this useful. If you spot an issue in the benchmark setup or interpretation, I would genuinely be interested in hearing it. And if you have any questions, feel free to leave them in the comments.</p><p>Thanks for reading, and have a great day.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b18d182f4e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Using keySet() Instead of entrySet() in TreeMap Can Hurt Performance]]></title>
            <link>https://prateeknima.medium.com/why-using-keyset-instead-of-entryset-in-treemap-can-hurt-performance-9674f5a8d591?source=rss-eab44bd82f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/9674f5a8d591</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Prateek Nima]]></dc:creator>
            <pubDate>Thu, 30 Apr 2026 12:15:41 GMT</pubDate>
            <atom:updated>2026-04-30T12:15:41.757Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZxpeQRTgZcqCvzrQ" /><figcaption>Photo by <a href="https://unsplash.com/@agforl24?utm_source=medium&amp;utm_medium=referral">Tai Bui</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Maps in Java are one of the primary data structures in the Collections Framework. When sorting is required, we can use a TreeMap instead of a HashMap, as TreeMap maintains entries in sorted order by default. It is part of the Map hierarchy.</p><p>Often, when we want to iterate through a HashMap, we do it in the following manner:</p><pre>Map&lt;Integer, Integer&gt; map = new HashMap&lt;&gt;();<br>map.put(1, 2);<br>map.put(7, 9);<br><br>for (int key : map.keySet()) {<br>    int value = map.get(key);<br><br>    // do something<br>}</pre><p>All these operations happen with an average time complexity of <strong>O(1)</strong>.</p><p>For a detailed explanation you can go through <a href="https://medium.com/swlh/internal-working-of-hashmap-in-java-e5b67890e152"><strong><em>this blog</em></strong></a> on Java HashMap.</p><p>Internally, a TreeMap is implemented using a Red-Black Tree to maintain sorted order. As a result, unlike HashMap, operations such as insertion, deletion, and retrieval no longer take <strong>O(1)</strong> time, instead, they take <strong>O(log n)</strong> time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7u8MXoxNd4fZRqrrLX4WPA.png" /><figcaption>TreeMap Concept</figcaption></figure><p>When iterating through a TreeMap, developers often rely on muscle memory and end up writing code like this:</p><pre>Map&lt;Integer, Integer&gt; map = new TreeMap&lt;&gt;();<br>map.put(1, 2);<br>map.put(7, 9);<br><br>for (int key : map.keySet()) {<br>    int value = map.get(key);<br><br>    // do something<br>}</pre><p>The problem here is that the code remains the same, but the underlying data structure is different. In the case of a TreeMap, retrieving a value using get() has a time complexity of <strong>O(log n)</strong>.</p><p>Therefore, when we iterate over the keys and then retrieve each value separately, the map must traverse the Red-Black Tree for every lookup instead of accessing elements directly in <strong>O(1)</strong> time, as a HashMap does.</p><p>The recommended solution is to iterate using entrySet(), which provides direct access to both the key and value without performing additional lookups.</p><pre>Map&lt;Integer, Integer&gt; map = new TreeMap&lt;&gt;();<br>map.put(1, 2);<br>map.put(7, 9);<br><br>for (Map.Entry&lt;Integer, Integer&gt; entry : map.entrySet()) {<br>    int key = entry.getKey();<br>    int value = entry.getValue();<br><br>    // do something<br>}</pre><p>Since entrySet() gives direct access to each key-value pair, iteration remains efficient and avoids the repeated O(log n) lookups caused by calling get() for every key.</p><p>As a result, this approach performs in <strong>O(n)</strong> time instead of <strong>O(n log n)</strong>.</p><p>Below are the sample benchmark results</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kPm7Gx8spAgSp7xETZHm2Q.png" /><figcaption>Java TreeMap Iteration Benchmarks</figcaption></figure><blockquote>As we see, for small maps the difference is negligible, it becomes noticeable when:</blockquote><blockquote>- Working with large maps/datasets</blockquote><blockquote>- Performance critical applications</blockquote><blockquote>- If the loops are frequently executed</blockquote><blockquote>The same principle applies across many programming languages: when both key and value are needed, direct entry iteration avoids unnecessary lookup overhead and improves scalability.</blockquote><p>Thanks for reading this article, this one was a short one. If you liked the article then please share it with your friends and colleagues. If you have any questions please feel free to shoot them in the comments section below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9674f5a8d591" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Crack the LLM Code: Free Claude Code Experiments via Ollama and Compare with Cursor]]></title>
            <link>https://prateeknima.medium.com/llm-concepts-claude-code-vs-cursor-and-exploring-claude-code-for-free-via-ollama-ffca0855ee48?source=rss-eab44bd82f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffca0855ee48</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Prateek Nima]]></dc:creator>
            <pubDate>Wed, 15 Apr 2026 11:40:52 GMT</pubDate>
            <atom:updated>2026-04-15T15:26:00.753Z</atom:updated>
            <content:encoded><![CDATA[<h3>Crack the LLM Code: Free Claude Code Experiments privately via Ollama and Compare with Cursor</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PRaIiEjREdZE30OR" /><figcaption>Photo by <a href="https://unsplash.com/@steve_j?utm_source=medium&amp;utm_medium=referral">Steve A Johnson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Recently, there has been significant development in IDEs, LLMs, and related technologies. Here, we provide a brief overview of what’s happening in this space.</p><h3>Prompt Engineering:</h3><p>Whenever we type anything in the UI, the query/text needs to be broken down such that it can be understood by the LLM models, keeping efficiency in mind. This is done by breaking a single prompt into a series of prompts or sub-prompts, which act in a series of pipelines. The first prompt collects information that is used to generate the next prompt.</p><h3>Context Engineering:</h3><p>When prompts are passed, we can’t pass everything to LLMs, and they would also need access to file information. For e.g. in the case of Claude Code, for LLMs to think, the input also needs to have access to a particular file, the previous history of the user, if any, the current state, and make changes to the file. This is where context engineering fits in.</p><p>They work all together to deliver the final result.</p><blockquote>You can also read more about Context and Prompt Engineering in <a href="https://www.elastic.co/search-labs/blog/context-engineering-vs-prompt-engineering">this</a> great article by Elastic.</blockquote><h3>What is context window:</h3><ul><li>The context window is the main constraint that most AI agents face these days, but most of the devs don’t understand how important it is.</li><li>The context window is the entire set of input tokens in the LLM’s. Input tokens are something that you pass to LLM’s, it could be a system prompt or a user message.</li><li>As we talk more, the context window limit hits. You might also hit this with a super long text message, uploading documents, or you are asking to transcribe a video. The limit is usually described in tokens.</li><li>You can check the limits at <a href="https://models.dev/"><em>https://models.dev/</em></a></li></ul><h3>Parameters in a model:</h3><ul><li>The model’s intelligence is directly correlated to the number of parameters it handles. Each parameter assigns a weight to your prompt, based on which the output is derived.</li><li>There are a number of parameters at each layer, for e.g. for cooking we can have 3 layers. Layer 1: Ingredients, Layer 2: Cooking, Layer 3: Seasoning. Consider Layer 1, based on the number of parameters, the specific ingredients will be added; the more the number of parameters, the more accurate it is. Parameters simply lie inside each layer that control how inputs are transformed as they move through the network.</li></ul><h3>Cursor vs Claude Code:</h3><h4>Cursor: IDE</h4><ul><li>Cursor indexes your entire code structure directory. This helps Cursor to get the entire context of your code thereby giving better adaption to your hierarchy.</li><li>Uses a vector database to index your code base, thereby enabling it have better understanding of whats going on, and highly beneficial for large codebases.</li><li>Integrates smoothly into your workflow with three modes:</li></ul><p><strong>TAB Mode — </strong>Quick inline suggestions</p><p><strong>CMD + K Mode</strong> — On-demand context-aware completions</p><p><strong>Agent Mode</strong> — Advanced multi-step assistance</p><ul><li>Supports inline editing for faster code changes without leaving your current context.</li><li>Offers a wide range of AI model options for different coding needs as seen below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mzJerE1D1PNr76rgbNRk6Q.png" /></figure><h4><strong>Claude Code: CLI tool</strong></h4><ul><li>You don’t micromanage here, you think in a design space at macro level.</li><li>Claude Code uses command line grep to recursively traverse code bases. You might not notice difference in small codebases but it might be a good deal in large enterprise applications.</li><li>It takes over the workflow for sometime.</li><li>You only have one option, you type a prompt and generates the code — the tasks can be simple(Typos), medium(Add a new feature), or complex(Refactoring).</li><li>It doesn’t allow inline editing, you need to prompt again and it does use your tokens.</li><li>Claude code is Anthropic only — but this doesn’t mean you under estimate Anthropic models, they are really good and helps you get consistent outputs.</li></ul><h3>Run Claude Code Locally via Ollama:</h3><ul><li>We can simply go to <a href="https://ollama.com/"><strong><em>https://ollama.com/</em></strong></a></li><li>Run the terminal command, for e.g. <strong><em>curl -fsSL </em></strong><a href="https://ollama.com/install.sh"><strong><em>https://ollama.com/install.sh</em></strong></a><strong><em> | sh</em></strong> for Mac and then <strong><em>ollama lauch claude</em></strong></li><li>Once you do this, there will be a pop to select the models as seen in the screenshot below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GkUiyX-iu6Me4EV4fI6yIg.png" /></figure><ul><li>You can also check the lastest models at <a href="https://ollama.com/search"><strong><em>https://ollama.com/search</em></strong></a>.</li><li>The local models allow us to keep it completely private and play around with it, although the trade off is you get comparatively less intelligence and optimizations than Anthropic.</li><li>You can select the model as per your requirement and system capabilities. As seen in the above screenshot qwen3.5 is suggested for a 11GB RAM. The more amount of RAM you provide the more parameters you get access to.</li></ul><blockquote><strong><em>Many places such as Banks, Hospitals, Government, and many others, can’t use Claude, thereby making this approach highly useful. Anthropic doesn’t provide any free trial and this approach helps users to get a hands on it. This enables them to get new users without any costs to them.</em></strong></blockquote><blockquote><strong><em>Ca</em></strong>veats:</blockquote><blockquote>Even though this approach allow us to use Claude Code without paying it for free, there are a few points to keep in mind.</blockquote><blockquote>This is highly useful for developers who want to try, test, or work in a private and/or self hosted environments but managing models locally can be highly inconvenient as you will need to manage everything by yourself.</blockquote><blockquote>You can also use cheaper cloud alternative but trust and intelligence come into play. Anthropic models are highly intelligent, the cheaper alternatives won’t be viable.</blockquote><blockquote>Trust and Safety is another factor, <em>Anthropic brands itself as the “Safety First” company.</em></blockquote><p>I hope you liked this article. Please feel free to comment with your thoughts below and follow me for more. Do do share it with your colleagues and friends if you liked this or helped you to learn something new.</p><p>Wishing you a productive day ahead ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffca0855ee48" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integer Caching in Java. Could it help enhance your application’s performance?]]></title>
            <link>https://medium.com/swlh/integer-caching-in-java-could-it-help-enhance-your-applications-performance-178bf72a5565?source=rss-eab44bd82f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/178bf72a5565</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[caching]]></category>
            <category><![CDATA[application-performance]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Prateek Nima]]></dc:creator>
            <pubDate>Sun, 10 Nov 2024 12:12:28 GMT</pubDate>
            <atom:updated>2024-11-10T12:12:28.435Z</atom:updated>
            <content:encoded><![CDATA[<p>In Java, we encounter many concepts, but caching in Java is one that’s not widely known or often discussed.</p><p>To keep it concise, Caching is a process where we store data in the RAM memory. Now the first question that might arise in you mind is why don’t we store all the data in the RAM. The reason is the RAM memory is the most expensive and must be used wisely as seen in the representation below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KRUMLmww2J0uJKy0UWhLkg.png" /><figcaption>fig (a) — Memory Hierarchy</figcaption></figure><p>For dealing with data, Java provides two ways that are primitives(int, double, boolean) and wrapper classes(Integer, Double, Boolean). The reason for providing dual approach is to offer advantages and strike a balance between the overall performance and Object Oriented Programming.</p><p>For e.g. using primitive types helps us to improve our application performance while using Java Collection framework only supports using the wrapper classes and they integrate smoothly with class based architecture.</p><p>Now coming to caching, consider the following example.</p><pre>Integer p = 20;<br>Integer q = 20;<br>System.out.println(p == q); // Statement 1 - This returns a true<br><br>Integer x = 200;<br>Integer y = 200;<br>System.out.println(x == y); Statement 2- This returns a false</pre><blockquote>As we see above, Java only caches wrapper classes and not primitives since the reason being that objects are only come into play when we use the wrapper classes.</blockquote><p>The reason statement 1 returns a true and statement 2 returns a true is because Java only caches the values that lie in a certain threshold value, the default value for which lies between -127 to 128. <strong>These are stored in the heap memory.</strong> The range can be further modified using the <strong>-XX:AutoBoxCacheMax </strong>in the command line.</p><blockquote>Note 1:- In the above example(statement 2) if we do x.equals(y) instead, it will return a true, since the == does the object comparison while x.equals(y) does a value comparison</blockquote><blockquote>Note 2:- Here we primarily consider integer as an example but it is also applicable to other wrapper classes such as float.</blockquote><p>Please feel free to comment with your thoughts below and follow me for more interesting articles. Do do share it with your friends if you liked the article and helped you to learn something new.</p><p>Have a great day ahead :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CZW7zW4pE_QYHI4pkF8vzg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=178bf72a5565" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/integer-caching-in-java-could-it-help-enhance-your-applications-performance-178bf72a5565">Integer Caching in Java. Could it help enhance your application’s performance?</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How does SOLID Principles help us to write better code?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swlh/how-does-solid-principles-help-to-write-better-code-aace8a0d7849?source=rss-eab44bd82f61------2"><img src="https://cdn-images-1.medium.com/max/1122/1*N8NCT12l-uTItoK2rFJlWw.gif" width="1122"></a></p><p class="medium-feed-snippet">In the same way that a new house must have a structure for its development, so too does writing new code require a structure and good&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/swlh/how-does-solid-principles-help-to-write-better-code-aace8a0d7849?source=rss-eab44bd82f61------2">Continue reading on The Startup »</a></p></div>]]></description>
            <link>https://medium.com/swlh/how-does-solid-principles-help-to-write-better-code-aace8a0d7849?source=rss-eab44bd82f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/aace8a0d7849</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[sdlc]]></category>
            <dc:creator><![CDATA[Prateek Nima]]></dc:creator>
            <pubDate>Tue, 18 Jun 2024 12:12:41 GMT</pubDate>
            <atom:updated>2024-08-18T21:00:45.171Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What are Daemon threads in Java? Why are they so crucial?]]></title>
            <link>https://prateeknima.medium.com/what-are-daemon-threads-in-java-why-are-they-so-crucial-e6d76178c02d?source=rss-eab44bd82f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6d76178c02d</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[jvm]]></category>
            <dc:creator><![CDATA[Prateek Nima]]></dc:creator>
            <pubDate>Mon, 20 May 2024 08:21:21 GMT</pubDate>
            <atom:updated>2024-08-18T21:00:17.892Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_VXnCMpT8gGgLJ43" /><figcaption>Photo by <a href="https://unsplash.com/@markfb?utm_source=medium&amp;utm_medium=referral">Mark Fletcher-Brown</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When working with multi-threaded applications it is extremely important to understand its entire workflow from thread creation, and thread interaction, to thread destruction. Each of the phases plays a crucial role in how your application behaves and its consistency when it is being scaled.</p><p>New threads are created for processes and the Java Virtual Machine(JVM) is not allowed to exit until all the threads running are completed even after the program execution completes. But some threads are of low priority or <em>we can say they act as a supporting actor during the execution lifecycle of User threads</em>. These types of threads are known as Daemon threads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GbXfuEuqSignZAWVioGK6w.png" /><figcaption>Fig(a) — Types of threads</figcaption></figure><p>When to utilize the daemon thread comes to user choice. Following are a few of the examples that depict the use-case of daemon threads.</p><p>Garbage collection:- JVM uses daemon thread for garbage collection by cleaning the memory and thereby allowing it to be available for reallocation.</p><p>Cache cleanup:- Clean the cache at regular time intervals. This can be considered similar to what we have with garbage collection.</p><p>Backup processes:- Synchronisation of data between different storage systems, thereby ensuring the data remains consistent.</p><p>Database maintenance:- This could consist of tasks such as database defragmentation.</p><p>Notification systems:- This could consist of sending emails or push notifications to the users at regular intervals or when a particular condition is met.</p><blockquote>A thread can be marked as a daemon by calling the method <strong>.setDaemon(true).</strong> It should be noted that once the thread is started we cannot then change its state i.e. from user thread to daemon thread and vice versa.</blockquote><p>A few critical properties to note about daemon threads:-</p><ul><li>The child of the daemon thread takes the property of the parent i.e. if the parent is a daemon thread, the child will be also a daemon thread.</li><li>The lifecycle of the daemon thread is completely dependent on the lifecycle of the application.</li><li>The JVM is terminated as soon as the user thread is terminated and it does not wait for the completion of the daemon thread. An important thing to note here is that even the finally block is not executed.</li><li>It is a thread with the lowest priority and the user thread would be prioritized for CPU allocation.</li></ul><p>In this article, we went through the significance, properties, and some use cases of the daemon thread. I hope you liked this article. Please feel free to comment with your thoughts below and follow me for more interesting articles.</p><p>Have a great day ahead :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qIEbbq6AvB0ZQbkGr0vow.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6d76178c02d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java UNSAFE class, does it make Java unsafe?]]></title>
            <link>https://medium.com/swlh/java-unsafe-class-does-it-make-java-unsafe-40ca367d0a19?source=rss-eab44bd82f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/40ca367d0a19</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[java-virtual-machine]]></category>
            <category><![CDATA[java-memory-management]]></category>
            <category><![CDATA[memory-leak]]></category>
            <category><![CDATA[core-java]]></category>
            <dc:creator><![CDATA[Prateek Nima]]></dc:creator>
            <pubDate>Mon, 15 Apr 2024 06:43:48 GMT</pubDate>
            <atom:updated>2024-08-18T21:01:04.891Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OTiyORn0VIsdqy6g" /><figcaption>Photo by <a href="https://unsplash.com/@imattsmart?utm_source=medium&amp;utm_medium=referral">iMattSmart</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Java, released in 1995, has evolved widely in the past 2-centuries. Currently, Java follows two types of release cycles:- (1) a 6-month rapid release cycle (since Java 10) and (2) a new LTS release cycle every two years that brings us updates and performance improvements.</p><p>All the changes carried out by Java are by default of a safe nature i.e. they are designed in such a way that all the operations follow several aspects of the Java programming environment and its runtime environment. That includes, and, is not limited to, safe usage for Memory Management, Type Safety, Security, exception handling, concurrency control, and no explicit pointer.</p><p><a href="https://docs.oracle.com/middleware/1213/coherence/java-reference/com/tangosol/util/Unsafe.html#:~:text=Class%20Unsafe&amp;text=A%20collection%20of%20%22back%2Ddoor,consistent%20from%20release%20to%20release."><strong><em>UNSAFE</em></strong></a><strong><em> </em></strong>is a class in Java that provides access to underlying low-level operations that are not provided by the Java APIs. It bypasses the checks that make Java of a safe nature. The below figure shows us a high-level workflow of using standard Java APIs vs using Unsafe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_7difuSTRyMMsXJsObTpRA.gif" /><figcaption>fig (a) Using standard Java APIs vs Using Unsafe</figcaption></figure><p>Unsafe class is widely being used by developers across the world to access internal data structures and improve application performance. As the name suggests, although there are benefits, it comes with its own potential drawbacks.</p><blockquote>As per Oracle “Just because you can break the rules, doesn’t mean you should break the rules — unless you have a good reason.”</blockquote><p><strong>So let’s discuss some of its benefits and drawbacks.</strong></p><h4>Benefits:-</h4><ol><li>It can be used to access off-heap memory i.e. outside Java heap and this helps to achieve more fine-grained control as the off-heap memory is never garbage collected.</li><li>Can be used to get access to a class object without running its constructor. (Yes you hear it right!)</li><li>Has direct access to the memory and can be used for read and write operations.</li><li>As we can manipulate the memory it can be therefore be used to fine-grain the data structures and improve its performance.</li></ol><h4>Drawbacks:-</h4><ol><li>As we are controlling the memory, it can lead to memory leaks.</li><li>It can be used for serialization and deserialization.</li><li>Memory corruption</li><li>Security vulnerabilities</li></ol><p><strong><em>There are other countless benefits and drawbacks of using UNSAFE.</em></strong></p><blockquote>Oracle itself doesn’t promote usage of unsafe classes, In fact, UNSAFE when it was first available in Java 1.4(sun.misc.Unsafe), was just released as a part of internal usage. Over time, developers began utilizing it, and now many Java applications rely on it. Discussions have highlighted concerns about potential misuse and its impact on Java application stability and security. In Java 11, Oracle made changes and deprecated some methods, moving them to two separate classes: jdk.internal.misc.Unsafe (in java.base) and sun.misc.Unsafe (in jdk.unsupported). Removing the Unsafe class currently poses challenges as it would affect the functionality of numerous Java applications.</blockquote><p>Thanks for reading this article so far. If you liked the article then please share it with your friends and colleagues(especially the Java nerds ;p). If you have any questions please feel free to shoot them in the comments section below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qIEbbq6AvB0ZQbkGr0vow.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40ca367d0a19" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/java-unsafe-class-does-it-make-java-unsafe-40ca367d0a19">Java UNSAFE class, does it make Java unsafe?</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terminologies in a Multithreading Environment in Software World]]></title>
            <link>https://prateeknima.medium.com/terminologies-in-a-multithreading-environment-5585869a8b00?source=rss-eab44bd82f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/5585869a8b00</guid>
            <category><![CDATA[multithreading]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Prateek Nima]]></dc:creator>
            <pubDate>Fri, 03 Mar 2023 14:42:42 GMT</pubDate>
            <atom:updated>2024-08-18T21:01:56.570Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pBcJiOeg8jcZ-LZE" /><figcaption>Photo by <a href="https://unsplash.com/@amr_taha?utm_source=medium&amp;utm_medium=referral">Amr Taha™</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The following are a few of the important terminologies you should be aware of in a multithreaded environment.</p><h4>Difference between Program vs Process vs Thread</h4><ul><li>A program is a set of instructions and associated data that sits on the disk and is loaded by the operating system to perform some tasks.</li><li>A process belongs to a program. It is a program in execution. A process is an execution environment that consists of a set of instructions, user data, and other resources such as CPU, memory, address space, disk, and network I/O acquired at runtime.</li><li>Thread is the smallest unit of execution in a process. A thread simply executes instructions serially. A process can have multiple threads running as a part of it. Each thread would have a state private to it. The global state shared by the process is accessible by all the threads and the programmer should pay extra attention when a thread tries to access this global state.</li></ul><h4>Serial Execution vs Concurrency vs Parallelism</h4><ul><li>When a program is serially executed, they are scheduled one at a time.</li><li>Concurrency is when it seems that the programs are executing simultaneously in an overlapping timeframe but in reality, the context gets switched so quickly that it seems to execute in parallel to humans. One program can be suspended while the other executes and this helps to improve the overall throughput and minimize latency.</li><li>Parallelism is when in reality the programs are executed in parallel. Usually, the hardware comes into play in this case, and is when we use multicore processor systems or in the case of computing clusters where multiple/several machines execute the independent pieces of a program.</li></ul><h4>I/O bound vs CPU bound</h4><p>A program in execution utilizes your system resources such as CPU time, Disk storage, Networking resources, Memory, etc. The usage of resources is completely dependent on the type of program and is widely categorized into CPU-bound and I/O-bound programs. CPU-bound programs require powerful CPU resources for their execution. I/O bound operations are programs that are dependent on input-output operations and primarily consist of writing and reading from the main memory. The CPU-bound operations can be optimized by adding the CPU while the efficiency of I/O bound can be optimized by giving up the CPU when the I/O operations are occurring.</p><h4>Synchronous vs Asynchronous execution</h4><ul><li>Synchronous execution means each line of the code is executed line by line and the next line cannot execute until the previous line execution has been completed.</li><li>In the case of asynchronous execution, the next line of the code can execute even if the previous line execution is not completed for e.g. a function call. Have you ever imagined how google drive enables us to carry out any tasks even while the file uploads are in progress?</li></ul><h4>Cooperative Multitasking vs Preemptive Multitasking</h4><ul><li>In Preemptive multitasking, the operating system scheduler is the big boss who decides which program to run and for how long it can run. The disadvantage of this is that the program gets switched it doesn’t know when it will get the CPU again.</li><li>In Cooperative multitasking, the program is responsible to give back the context so that other programs can execute. The disadvantage of this is if a malicious program takes the context, it would run indefinitely without returning the context.</li></ul><h4>Throughput &amp; Latency</h4><p>Throughput means the amount of work done per unit of time while latency is the overall time required to complete a task. As the throughput of an application goes up its latency goes down.</p><h4>Critical Section, Race Condition, Deadlocks</h4><p>A critical section is a part of code which have the chance of being executed concurrently by multiple threads. Whenever threads execute concurrently, each thread tries to complete its execution first, when this happens in the critical section of the code it leads to inconsistencies in the application. If thread A is accessing a resource R1 in the code and if there is thread B accessing a resource R2, and if both threads are waiting for the other resource to be freed up (thread A is waiting for resource R2 and thread B is waiting for resource R1) this leads to a condition known as Deadlock.</p><p>I hope you liked this article. Please feel free to comment with your thoughts below and follow me for more interesting articles.</p><p>Have a great day ahead :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qIEbbq6AvB0ZQbkGr0vow.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5585869a8b00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java JDK 20, what can we expect?]]></title>
            <link>https://prateeknima.medium.com/java-jdk-20-what-can-we-expect-e932a576b1ae?source=rss-eab44bd82f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/e932a576b1ae</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[jdk-20]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Prateek Nima]]></dc:creator>
            <pubDate>Wed, 01 Mar 2023 21:32:54 GMT</pubDate>
            <atom:updated>2024-08-18T21:02:24.691Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4QdrIJ9BoazONlMW" /><figcaption>Photo by <a href="https://unsplash.com/@leunesmedia?utm_source=medium&amp;utm_medium=referral">Michiel Leunens</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Oracle Java release cycle is every 6 months and Java JDK 20 is set to release on March 21, 2023. Currently, there are six features that are official to be released and can be seen in <a href="https://openjdk.org/projects/jdk/20/">this</a> official OpenJDK specification. The following are the new features:</p><h4>Scoped Values(Version: Incubator):</h4><p>Scoped values enable us to share immutable data across threads. It is the preferred way and alternative to <a href="https://medium.com/swlh/multithreading-with-threadlocal-making-the-threads-work-for-you-1523f038d268"><em>ThreadLocal</em></a> in a multithreading environment. It helps components share data without resorting to method arguments. This feature is being incubated.</p><h4>Virtual Threads(Version: Second Preview):</h4><p>Virtual threads were introduced in Java 16 and helped us to create and manage threads. It is an alternative to the traditional threads which offer better performance. They are lightweight and not directly mapped to the operating system. They share single pool memory space with other virtual threads thereby making creation, destruction, and context switching of threads much quicker. There are minor API changes to this in JDK 20 including degradations to ThreadGroup.</p><h4>Structured Concurrency(Version: Second Incubator):</h4><p>Structured Concurrency provides control over the execution of code blocks in the multithreaded environment. It provides control over execution. It treats tasks running in different threads as a single unit of work. This feature is being incubated.</p><h4>Vector API(Version: Fifth Incubator):</h4><p>Vector API was introduced in Java 16 to provide parallel processing of numerical computation of data. <strong>Stream.parallel()</strong> introduced in Java 8 would sound similar to vector API but the latter was specifically provided for numerical computation at a low-level mechanism. In normal processing, it adds two pieces of data in one go also called Single Instruction, Single Data(SISD), while in the case of Vector API, it takes two chunks of data and processes it simultaneously also called Single Instruction Multiple Data(SIMD). The JDK 20 update includes bug fixes and improved performance.</p><h4>Record Patterns(Second Preview):</h4><p>Record patterns and type patterns can be nested to enable a powerful, declarative, and composable form of data navigation and processing. The main changes for this preview are support for an inference of type arguments of generic record patterns, support for record patterns to appear in the header of an enhanced statement, and removal of support for named record patterns.</p><blockquote>One of the examples for record pattern is in the if statement we can directly store the value into a variable as follows:</blockquote><blockquote>if (o instanceof String str)</blockquote><blockquote>{</blockquote><blockquote>System.out.println(str);</blockquote><blockquote>}</blockquote><h4>Pattern matching for switch(Version: Fourth Preview):</h4><p>Pattern matching for switch statements is a new feature introduced in Java 16, that along with value matching, also allows switch statements to match values based on their type, and structure, and further perform different actions based on the match condition.</p><p>The changes since the last preview include</p><p>As per the <a href="https://openjdk.org/jeps/433">documentation</a>, the main changes since the third preview are:</p><ul><li>An exhaustive switch (i.e., a switch expression or a pattern switch statement) over an enum class now throws MatchException rather than IncompatibleClassChangeError if no switch label applies at run time.</li><li>The grammar for switch labels is simpler.</li><li>Inference of type arguments for generic record patterns is now supported in switch expressions and statements, along with the other constructs that support patterns.</li></ul><p>This release version of JDK is a short-term feature release. You can register for the release event from this <a href="https://developer.oracle.com/community/events/devlive-level-up-march-2023.html">link</a>. Thanks for reading this article, if you have any questions please feel free to comment down below. I hope you have a great day ahead :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qIEbbq6AvB0ZQbkGr0vow.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e932a576b1ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building blocks of a Software System Design]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://prateeknima.medium.com/building-blocks-of-a-system-design-494207b1820e?source=rss-eab44bd82f61------2"><img src="https://cdn-images-1.medium.com/max/2600/0*BjuQmU5M9RhxhTHl" width="5184"></a></p><p class="medium-feed-snippet">Nowadays, to build a good distributed system, it is necessary to utilize multiple services which combined together help us to deploy&#x2026;</p><p class="medium-feed-link"><a href="https://prateeknima.medium.com/building-blocks-of-a-system-design-494207b1820e?source=rss-eab44bd82f61------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://prateeknima.medium.com/building-blocks-of-a-system-design-494207b1820e?source=rss-eab44bd82f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/494207b1820e</guid>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Prateek Nima]]></dc:creator>
            <pubDate>Mon, 27 Feb 2023 04:53:21 GMT</pubDate>
            <atom:updated>2024-08-18T21:02:37.706Z</atom:updated>
        </item>
    </channel>
</rss>