Algorithms

Internal Working of TreeMap in Java

<p>This is another very frequently asked <strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;core-java-baby-step-to-be-best-java-ian&sol;">Java<&sol;a> <&sol;strong>Developer <strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;core-java-interview-questions&sol;">Interview Questions<&sol;a><&sol;strong> of Internal Working of <strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;treemap-class-in-collection-framework&sol;">TreeMap in Java<&sol;a><&sol;strong>&period; How TreeMap works and what is an internal implementation of TreeMap&period; In our previous articles&comma; we have already discussed other popular<strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;core-java-interview-questions&sol;"> java interview questions<&sol;a><&sol;strong> such as the <strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;internal-working-of-hashmap-in-java&sol;">internal working of HashMap<&sol;a><&sol;strong> and <strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;internal-working-of-linkedhashmap-in-java&sol;">internal working of LinkedHashMap<&sol;a><&sol;strong>&period; Also&comma; we have discussed&comma; what is the <strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;difference-between-treemap-vs-hashmap&sol;">difference between HashMap and TreeMap<&sol;a><&sol;strong>&period; In this article&comma; we will discuss the Internal Working of TreeMap in Java&period;<&sol;p>&NewLine;<blockquote><p><strong>LinkedList Algorithms Interview Questions<&sol;strong><&sol;p>&NewLine;<p><strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;find-and-break-a-loop-in-a-linked-list&sol;">Find and Break a Loop in a Linked list<&sol;a><&sol;strong><br &sol;>&NewLine;<strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;how-to-detect-loop-in-a-linked-list&sol;">How to Detect loop in a linked list<&sol;a><&sol;strong><br &sol;>&NewLine;<strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;nth-node-from-the-end-of-a-singly-linked-list&sol;">Find the nth node from the end of a singly linked list<&sol;a><&sol;strong><br &sol;>&NewLine;<strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;find-the-middle-element-in-a-linked-list&sol;">Find the middle element in a linked list<&sol;a><&sol;strong><br &sol;>&NewLine;<strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;reverse-linked-list&sol;">How to Reverse linked list in Java<&sol;a><&sol;strong><br &sol;>&NewLine;<strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;delete-given-node-from-singly-linked-list&sol;">Delete given node from a singly linked list<&sol;a><&sol;strong><br &sol;>&NewLine;<strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;remove-duplicates-from-the-unsorted-singly-linked-list&sol;">Remove Duplicates from the Unsorted Singly Linked list<&sol;a><&sol;strong><br &sol;>&NewLine;<strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;singly-linked-list-is-palindrome&sol;">The singly linked list is palindrome without extra space<&sol;a><&sol;strong><&sol;p><&sol;blockquote>&NewLine;<h2>TreeMap in Java<&sol;h2>&NewLine;<p>The TreeMap is used to implement <strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;map-interface-in-collection&sol;">Map interface<&sol;a><&sol;strong> and <em>NavigableMap<&sol;em> along with the Abstract Class&period; <em>TreeMap<&sol;em> does not use hashing for storing key unlike the <em>HashMap<&sol;em> and <em>LinkedHashMap<&sol;em> use hashing for storing the key&period; <em>HashMap<&sol;em> and <em>LinkedHashMap<&sol;em> use array data structure to store nodes but the <em>TreeMap<&sol;em> uses a data structure called Red-Black tree&period; Also&comma; all its elements store in the <em>TreeMap<&sol;em> are sorted by key&period; <em>TreeMap<&sol;em> performs sorting in natural order on its key&comma; it also allows you to use <strong><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;java-comparable-and-comparator&sol;&num;&period;VGtB4jSUeLp">Comparator<&sol;a><&sol;strong> for custom sorting implementation&period; We can provide <em>Comparator<&sol;em> at map creation time&comma; depending on which constructor is used&period; Let&&num;8217&semi;s see the following&colon;<&sol;p>&NewLine;<ul>&NewLine;<li><strong>TreeMap&lpar;&rpar;&colon;<&sol;strong> This default constructor constructs an empty <em>TreeMap<&sol;em> that will be sorted by using the natural order of its keys&period;<&sol;li>&NewLine;<li><strong>TreeMap&lpar;Comparator comp&rpar;&colon;<&sol;strong> This is an argument constructor and it takes <em>Comparator<&sol;em> object to constructs an empty tree-based map&period; It will be sorted by using the <em>Comparator<&sol;em> comp&period;<&sol;li>&NewLine;<li><strong>TreeMap&lpar;Map map&rpar;&colon;<&sol;strong> It creates a TreeMap with the entries from a map&comma; which will be sorted by using the natural order of the keys&period;<&sol;li>&NewLine;<li><strong>TreeMap&lpar;SortedMap sortedMap&rpar;&colon;<&sol;strong> It also initializes a <em>TreeMap<&sol;em> with the entries from sortedMap&comma; which will be sorted in the same order as sortedMap&period;<&sol;li>&NewLine;<&sol;ul>&NewLine;<p>As we have seen various overloaded constructors of a <em>TreeMap<&sol;em>&period; Let&&num;8217&semi;s see the performance factor of the <em>TreeMap<&sol;em> as the below&colon;<&sol;p>&NewLine;<h2>Performance of TreeMap<&sol;h2>&NewLine;<p>Performance wise <em>TreeMap<&sol;em> is slow if you will compare with <em>HashMap<&sol;em> and <em>LinkedHashMap<&sol;em>&period; The <em>TreeMap<&sol;em> provides guaranteed log&lpar;n&rpar; time complexity for the methods such as <em>containsKey&lpar;&rpar;&comma; get&lpar;&rpar;&comma; put&lpar;&rpar; and remove&lpar;&rpar;&period;<&sol;em><&sol;p>&NewLine;<p>Also&comma; a <em>TreeMap<&sol;em> is fail-fast in nature that means it is not synchronized and that is why is not thread-safe&period; You can make it thread-safe for multithreaded environments as the following&colon;<&sol;p>&NewLine;<pre>SortedMap m &equals; Collections&period;synchronizedSortedMap&lpar;new TreeMap&lpar;&period;&period;&period;&rpar;&rpar;&semi; &NewLine;<&sol;pre>&NewLine;<p>Let&&num;8217&semi;s discuss the internal structure of a <em>TreeMap<&sol;em>&period;<&sol;p>&NewLine;<h2>Internal Structure of TreeMap<&sol;h2>&NewLine;<p><em>TreeMap<&sol;em> is based on tree data structure as its name suggested&period; As we know that&comma; in a tree&comma; each node has three references its parent&comma; right and left element&period; Let&&num;8217&semi;s see the following diagram&colon;<&sol;p>&NewLine;<p><img class&equals;"aligncenter size-full wp-image-4304" src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2018&sol;10&sol;Treemap3-5&period;png" alt&equals;"Treemap Node" width&equals;"691" height&equals;"442" &sol;><br &sol;>&NewLine;As you can see in the above diagram&comma; there are three references in the node such as a parent&comma; right and left element with the following properties&colon;<&sol;p>&NewLine;<ol>&NewLine;<li>The <em>left<&sol;em> element will always be logically less than the <em>parent<&sol;em> element&period;<&sol;li>&NewLine;<li>The <em>right<&sol;em> element will always be logically greater than OR equal to a <em>parent<&sol;em> element<&sol;li>&NewLine;<li>The logical comparison of Objects is done by natural order i&period;e&period; those object who implement <em>Comparable<&sol;em> interface and override <em>compareTo&lpar;Object obj&rpar;<&sol;em> method&period; Based on the return value&comma;<&sol;li>&NewLine;<&sol;ol>&NewLine;<p>Let&&num;8217&semi;s see the following use of the <em>compareTo&lpar;&rpar;<&sol;em> method&colon;<&sol;p>&NewLine;<ul>&NewLine;<li>If obj1&period;compareTo&lpar;obj2&rpar; returns a negative number&comma; then obj1 is logically less than obj2&period;<&sol;li>&NewLine;<li>If obj1&period;compareTo&lpar;obj2&rpar; returns positive number then obj1 is logically greater than obj2<&sol;li>&NewLine;<li>If obj1&period;compareTo&lpar;obj2&rpar; returns zero&comma; then obj1 is equal to obj2&period;<&sol;li>&NewLine;<&sol;ul>&NewLine;<p>As we have discussed&comma; TreeMap is working based on the Red-Black tree&period;<&sol;p>&NewLine;<h2>Red Black tree<&sol;h2>&NewLine;<p>In this article&comma; I am not going to explain the Red Black algorithm in details&comma; let&&num;8217&semi;s see the pseudo code of Red Black algorithm in order to understand the internal implementation like the following&colon;<&sol;p>&NewLine;<ul>&NewLine;<li>As the name of the algorithm suggests&comma; a colour of every node in the tree is either red or black&period;<&sol;li>&NewLine;<li>Root node must be Black in color&period;<&sol;li>&NewLine;<li>A red node can not have a red colour neighbor node&period;<&sol;li>&NewLine;<li>All paths from a root node to the null should consist the same number of black nodes&period;<&sol;li>&NewLine;<&sol;ul>&NewLine;<h2>Internal Working of TreeMap in Java<&sol;h2>&NewLine;<p>Now&comma; we will discuss an example and see how does TreeMap work internally&period;<&sol;p>&NewLine;<pre>&sol;&ast;&ast; &NewLine; &ast; &NewLine; &ast;&sol; &NewLine;package com&period;dineshonjava&period;algo&period;map&semi; &NewLine; &NewLine;import java&period;util&period;Map&semi; &NewLine;import java&period;util&period;TreeMap&semi; &NewLine; &NewLine;&sol;&ast;&ast; &NewLine; &ast; &commat;author Dinesh&period;Rajput &NewLine; &ast; &NewLine; &ast;&sol; &NewLine;public class TreeMapTest &lbrace; &NewLine; &NewLine;&Tab;&sol;&ast;&ast; &NewLine;&Tab; &ast; &commat;param args &NewLine;&Tab; &ast;&sol; &NewLine;&Tab;public static void main&lpar;String&lbrack;&rsqb; args&rpar; &lbrace; &NewLine;&Tab;&Tab;Map&lt&semi;Key&comma; String&gt&semi; treemap &equals; new TreeMap&lt&semi;&gt&semi;&lpar;&rpar;&semi; &NewLine; treemap&period;put&lpar;new Key&lpar;"Anamika"&rpar;&comma; "Anamika"&rpar;&semi; &NewLine;&Tab;&Tab;treemap&period;put&lpar;new Key&lpar;"Rushika"&rpar;&comma; "Rushika"&rpar;&semi; &NewLine;&Tab;&Tab;treemap&period;put&lpar;new Key&lpar;"Dinesh"&rpar;&comma; "Dinesh"&rpar;&semi; &NewLine;&Tab;&Tab;treemap&period;put&lpar;new Key&lpar;"Arnav"&rpar;&comma; "Arnav"&rpar;&semi; &NewLine;&Tab;&rcub; &NewLine; &NewLine;&rcub; &NewLine; &NewLine;<&sol;pre>&NewLine;<p>Let&&num;8217&semi;s see Key class&colon;<&sol;p>&NewLine;<pre> &NewLine;&sol;&ast;&ast; &NewLine; &ast; &NewLine; &ast;&sol; &NewLine;package com&period;dineshonjava&period;algo&period;map&semi; &NewLine; &NewLine;&sol;&ast;&ast; &NewLine; &ast; &commat;author Dinesh&period;Rajput &NewLine; &ast; &NewLine; &ast;&sol; &NewLine;public class Key implements Comparable<Key>&lbrace; &NewLine;&Tab; &NewLine;&Tab;final int data &equals; 112&semi; &NewLine;&Tab;private String key&semi; &NewLine;&Tab; &NewLine;&Tab;public Key&lpar;String key&rpar; &lbrace; &NewLine;&Tab;&Tab;super&lpar;&rpar;&semi; &NewLine;&Tab;&Tab;this&period;key &equals; key&semi; &NewLine;&Tab;&rcub; &NewLine;&Tab; &NewLine;&Tab;&commat;Override &NewLine;&Tab;public int compareTo&lpar;Key obj&rpar; &lbrace; &NewLine;&Tab;&Tab;return key&period;compareTo&lpar;obj&period;key&rpar;&semi; &NewLine;&Tab;&rcub; &NewLine;&Tab; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<p>As you can see in the above Key class&comma; I didn&&num;8217&semi;t implement hashCode&lpar;&rpar; and equals&lpar;&rpar; method becuase TreeMap does not use hashing&period;<&sol;p>&NewLine;<h3>Let&&num;8217&semi;s understand step by step&period;<&sol;h3>&NewLine;<p><strong>Step 1&colon;<&sol;strong> Initially when we create a TreeMap object as<&sol;p>&NewLine;<pre>Map&lt&semi;Key&comma; String&gt&semi; treemap &equals; new TreeMap&lt&semi;&gt&semi;&lpar;&rpar;&semi; &NewLine;<&sol;pre>&NewLine;<p>There are no elements in it&period; Let&&num;8217&semi;s add the first element on it&period;<&sol;p>&NewLine;<p><strong>Step 2&colon; Adding the first element into TreeMap<&sol;strong><&sol;p>&NewLine;<pre>treemap&period;put&lpar;new Key&lpar;"Anamika"&rpar;&comma; "Anamika"&rpar;&semi; &NewLine;<&sol;pre>&NewLine;<p>So &lbrace;&&num;8220&semi;Anamika&&num;8221&semi;&rcub; is the first key object being inserted as key&period; This element will be root node for tree and structure for TreeMap becomes as below&period;<&sol;p>&NewLine;<p><img class&equals;"aligncenter wp-image-4305 size-full" src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2018&sol;10&sol;FirstIntegerInserted&period;png" alt&equals;"Internal Working of TreeMap in Java" width&equals;"316" height&equals;"219" &sol;><&sol;p>&NewLine;<p><strong>Step 3&colon; Adding the second element into TreeMap<&sol;strong><&sol;p>&NewLine;<pre>treemap&period;put&lpar;new Key&lpar;"Rushika"&rpar;&comma; "Rushika"&rpar;&semi; &NewLine;<&sol;pre>&NewLine;<p>Now&comma; &lbrace;&&num;8220&semi;Rushika&&num;8221&semi;&rcub; is logically greater than &lbrace;&&num;8220&semi;Anamika&&num;8221&semi;&rcub; and hence according to our rules&comma;<&sol;p>&NewLine;<ul>&NewLine;<li>&lbrace;&&num;8220&semi;Rushika&&num;8221&semi;&rcub; will be placed to the right of &lbrace;&&num;8220&semi;Anamika&&num;8221&semi;&rcub;&period;<&sol;li>&NewLine;<li>&lbrace;&&num;8220&semi;Anamika&&num;8221&semi;&rcub; will be a parent of &lbrace;&&num;8220&semi;Rushika&&num;8221&semi;&rcub;&period;<&sol;li>&NewLine;<&sol;ul>&NewLine;<p>After inserting this element&comma; the structure for TreeMap becomes as below&period;<&sol;p>&NewLine;<p><img class&equals;"aligncenter size-full wp-image-4306" src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2018&sol;10&sol;SecondIntegerInserted&period;png" alt&equals;"SecondElementInserted" width&equals;"742" height&equals;"372" &sol;><&sol;p>&NewLine;<p><strong>Step 4&colon; Adding third element into TreeMap<&sol;strong><&sol;p>&NewLine;<pre>treemap&period;put&lpar;new Key&lpar;"Dinesh"&rpar;&comma; "Dinesh"&rpar;&semi;<&sol;pre>&NewLine;<p>So &lbrace;&&num;8220&semi;Dinesh&&num;8221&semi;&rcub; is the first key object being inserted as key&period; This element will be root node for tree and structure for TreeMap becomes as below&period;<&sol;p>&NewLine;<p><img class&equals;"aligncenter size-full wp-image-4307" src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2018&sol;10&sol;ThirdObjectInserted-1&period;png" alt&equals;"ThirdElementInserted" width&equals;"1106" height&equals;"372" &sol;><&sol;p>&NewLine;<p>As you can see in the above diagram&comma; this element &lbrace;&&num;8220&semi;Dinesh&&num;8221&semi;&rcub; is the root node for a tree&period; As we have discussed above properties and rules of the Red-Black tree&comma; the Red-Black tree implementation will give us sorted order from left to right&period; So according to diagram elements of a tree become as below&period;<&sol;p>&NewLine;<ul>&NewLine;<li>&lbrace;&&num;8220&semi;Anamika&&num;8221&semi;&rcub; will be to the left of &lbrace;&&num;8220&semi;Dinesh&&num;8221&semi;&rcub;<&sol;li>&NewLine;<li>&lbrace;&&num;8220&semi;Rushika&&num;8221&semi;&rcub; will be to the right of &lbrace;&&num;8220&semi;Dinesh&&num;8221&semi;&rcub;<&sol;li>&NewLine;<&sol;ul>&NewLine;<p><strong>Step 5&colon; Adding the third element into TreeMap<&sol;strong><&sol;p>&NewLine;<pre>treemap&period;put&lpar;new Key&lpar;"Arnav"&rpar;&comma; "Arnav"&rpar;&semi;<&sol;pre>&NewLine;<p>So &lbrace;&&num;8220&semi;Arnav&&num;8221&semi;&rcub; is the first key object being inserted as key&period; After adding this element&comma; a structure for TreeMap becomes as below&period;<&sol;p>&NewLine;<p><img class&equals;"aligncenter size-full wp-image-4308" src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2018&sol;10&sol;FourthObjecctInserted&period;png" alt&equals;"FourthObjecctInserted" width&equals;"1106" height&equals;"555" &sol;><&sol;p>&NewLine;<p>As you can see in the above diagram of the TreeMap&comma; all elements are as below&colon;<&sol;p>&NewLine;<ul>&NewLine;<li>&lbrace;&&num;8220&semi;Anamika&&num;8221&semi;&rcub; will be to the left of &lbrace;&&num;8220&semi;Dinesh&&num;8221&semi;&rcub;<&sol;li>&NewLine;<li>&lbrace;&&num;8220&semi;Arnav&&num;8221&semi;&rcub; will be to right of &lbrace;&&num;8220&semi;Dinesh&&num;8221&semi;&rcub;<&sol;li>&NewLine;<li>&lbrace;&&num;8220&semi;Rushika&&num;8221&semi;&rcub; will be to right of &lbrace;&&num;8220&semi;Anamika&&num;8221&semi;&rcub;<&sol;li>&NewLine;<&sol;ul>&NewLine;<p>Hope this article is able to give much information about the internal working of <em>TreeMap<&sol;em> in Java&period;<&sol;p>&NewLine;<p>Happy Learning with DineshonJava&period;<&sol;p>&NewLine;<div align&equals;"center"><iframe style&equals;"width&colon; 120px&semi; height&colon; 240px&semi;" src&equals;"&sol;&sol;ws-in&period;amazon-adsystem&period;com&sol;widgets&sol;q&quest;ServiceVersion&equals;20070822&amp&semi;OneJS&equals;1&amp&semi;Operation&equals;GetAdHtml&amp&semi;MarketPlace&equals;IN&amp&semi;source&equals;ac&amp&semi;ref&equals;qf&lowbar;sp&lowbar;asin&lowbar;til&amp&semi;ad&lowbar;type&equals;product&lowbar;link&amp&semi;tracking&lowbar;id&equals;dineshonjav06-21&amp&semi;marketplace&equals;amazon&amp&semi;region&equals;IN&amp&semi;placement&equals;1788299450&amp&semi;asins&equals;1788299450&amp&semi;linkId&equals;05b0146b0a85f4472697901e353dc276&amp&semi;show&lowbar;border&equals;true&amp&semi;link&lowbar;opens&lowbar;in&lowbar;new&lowbar;window&equals;true&amp&semi;price&lowbar;color&equals;333333&amp&semi;title&lowbar;color&equals;0066c0&amp&semi;bg&lowbar;color&equals;ffffff" frameborder&equals;"0" marginwidth&equals;"0" marginheight&equals;"0" scrolling&equals;"no"><br &sol;>&NewLine;<&sol;iframe><&sol;div>&NewLine;<div align&equals;"center">&NewLine;<iframe width&equals;"560" height&equals;"315" src&equals;"https&colon;&sol;&sol;www&period;youtube&period;com&sol;embed&sol;787IEebrYXM" frameborder&equals;"0" allow&equals;"autoplay&semi; encrypted-media" allowfullscreen><&sol;iframe><&sol;div>&NewLine;<div class&equals;"wp-post-navigation"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-pre"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;internal-working-of-linkedhashmap-in-java&sol;">Previous<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-next"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;implement-lru-cache-algorithm-in-java&sol;">Next<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;<&sol;div>&NewLine;<script type&equals;"text&sol;javascript">&NewLine;jQuery&lpar;document&rpar;&period;ready&lpar;function&lpar;&dollar;&rpar; &lbrace;&NewLine; &dollar;&period;post&lpar;'https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-admin&sol;admin-ajax&period;php'&comma; &lbrace;action&colon; 'mts&lowbar;view&lowbar;count'&comma; id&colon; '4303'&rcub;&rpar;&semi;&NewLine;&rcub;&rpar;&semi;&NewLine;<&sol;script>

Dinesh Rajput

Dinesh Rajput is the chief editor of a website Dineshonjava, a technical blog dedicated to the Spring and Java technologies. It has a series of articles related to Java technologies. Dinesh has been a Spring enthusiast since 2008 and is a Pivotal Certified Spring Professional, an author of a book Spring 5 Design Pattern, and a blogger. He has more than 10 years of experience with different aspects of Spring and Java design and development. His core expertise lies in the latest version of Spring Framework, Spring Boot, Spring Security, creating REST APIs, Microservice Architecture, Reactive Pattern, Spring AOP, Design Patterns, Struts, Hibernate, Web Services, Spring Batch, Cassandra, MongoDB, and Web Application Design and Architecture. He is currently working as a technology manager at a leading product and web development company. He worked as a developer and tech lead at the Bennett, Coleman & Co. Ltd and was the first developer in his previous company, Paytm. Dinesh is passionate about the latest Java technologies and loves to write technical blogs related to it. He is a very active member of the Java and Spring community on different forums. When it comes to the Spring Framework and Java, Dinesh tops the list!

Share
Published by
Dinesh Rajput

Recent Posts

Strategy Design PatternsĀ using Lambda

Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…

4 years ago

Decorator Pattern using Lambda

Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…

4 years ago

Delegating pattern using lambda

Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…

4 years ago

Spring Vs Django- Know The Difference Between The Two

Technology has emerged a lot in the last decade, and now we have artificial intelligence;…

4 years ago

TOP 20 MongoDB INTERVIEW QUESTIONS 2022

Managing a database is becoming increasingly complex now due to the vast amount of data…

4 years ago

Scheduler @Scheduled Annotation Spring Boot

Overview In this article, we will explore Spring Scheduler how we could use it by…

4 years ago