Multithreading in real world

Most of you already know about threads and it’s benefits. This article will help you to understand how thread are being used in real world applications and what are the best practices. Threads are primarily used to achieve asynchronous  behavior and multitasking. Below are some common real life use cases where threads have been usedContinue reading “Multithreading in real world”

Rate this:

How HashMap works in Java

Note: Original article – http://javarevisited.blogspot.com/2011/02/how-hashmap-works-in-java.html How HashMap works in Java How HashMap works in Java or sometime how get method work in HashMap is common interview questions now days. Almost everybody who worked in Java knows what hashMap is, where to use hashMap or difference between hashtable and HashMap then why this interview question becomes so special? BecauseContinue reading “How HashMap works in Java”

Rate this:

Comparable and Comparator example

Comparable /* Result: Akshay Kumar Prashant Gupta Rajiv Srivastava */ /* ———— Sorting thru Comparator Interface (Custom Sorting) * Implements mandatory Comparator interface */ Comparator: /* Output: * Arvind Kejriwal Arvind Tendulkar Arvind Tripathi */

Rate this:

How to work with Java 6′s NavigableSet and NavigableMap

How to work with Java 6′s NavigableSet and NavigableMap: This is my first published article on  popular site – mkyong.com URL-http://www.mkyong.com/java/how-to-work-with-java-6s-navigableset-and-navigablemap/ Also, writing same article on my blog. Hope it will be helpful for you- Rajiv. You can use latest Java 6′s Collection API to navigate a set and Map collections. These API gives aContinue reading “How to work with Java 6′s NavigableSet and NavigableMap”

Rate this:

Difference between mvc1 and mvc2

n MVC-1 architecture (also referred as Model 1), the request is first handled by a JSP, that interacts with a Bean. Here the JSP page may have partial processing logic, although a bulk of processing logic may be handled by the beans that may interact with the database. The JSP in this case in additionContinue reading “Difference between mvc1 and mvc2”

Rate this:

Comparable Interface : Problem while adding object to TreeSet

Nice Article: Comparable Interface : Problem while adding object to TreeSet Can anyone tell me why this code fragment shows me the “ClassCastException”, Using Java 2 1.5 compiler. In the above code Set s=new TreeSet(); Set S which is a TreeSet accepts an object that is very true when developer adds an object new Person(20)Continue reading “Comparable Interface : Problem while adding object to TreeSet”

Rate this:

Why ConcurrentHashMap is better than Hashtable and HashMap ???

ConcurrentHashMap is a pretty ignored class. The class offers a very robust and fast (comparatively, we all know java concurrency isn’t the fastest) method of synchronizing a Map collection. There is no way you can compare the two, one offers synchronized methods to access a map while the other offers no synchronization whatsoever. What mostContinue reading “Why ConcurrentHashMap is better than Hashtable and HashMap ???”

Rate this: