Singleton pattern is a design solution where an application wants to have one and only one instance of any class, in all possible scenarios without any exceptional condition. It has been debated long enough in java community regarding possible approaches to make any class singleton. Still, you will find people not satisfied with any solution […]
Easy to follow examples of sorting a collection of objects in any order using Comparable or Comparator Interfaces.
Life has become very easy for java programmers working on multi-threaded applications after release of JDK 5. JDK 5 brought many features related to multi-threaded processing which were kind of nightmare for application developers, and even worse for those who had to debug this code in future for bug fixing. Sometimes, this resulted in deadlock […]
This article solves a very common problem of configuration reloading on run time, which is usually required in most of the today’s applications. In auto reload configuration using WatchService, we saw the use of JDK 7’s new API WatchService. In this post, i will use a rather easy approach i.e. apache commons configuration. .Using commons […]
In this tutorial, I will explain the encapsulation in java and its relation with abstraction. Also learn about information hiding and implementation hiding.
Learn about java abstract classes vs interfaces in details. Also learn about when to use interface and when to use abstract class in solving design issues.
In simple words, abstraction captures only those details about an object that are relevant to the current perspective. Learn more about abstraction in java.
In this post, I will write a piece of code which will create a deadlock situation and then i will discuss that way to resolve this scenario. In my previous post, i written about Auto reload of configuration when any change happen, i discussed about refreshing your application configuration using a thread. As configurations are shared […]
Today, most applications are required to manage their own log files included removing them when they reach at a particular size limit. In this article, i will try to propose a solution for this kind of log file management. I will also suggest the way to capture the output of linux process and log it […]
In my previous posts, i have discussed about HashMap’s internal working and how to correctly override equals() and hashCode() methods. In this post, i am writing about a solution of very common problem. Every application has some configuration which is expected to be refreshed on every change in configuration file. Past approaches to solve this […]
Most of you will agree that HashMap is most favorite topic for discussion in interviews now-a-days. I have gone through several discussions with my colleagues time to time and it really helped. Now, I am continuing this discussion with you all. I am assuming that if you are interested in internal working of HashMap, you […]
In this post, I will point out my understanding about hashCode() and equals() methods. I will talk about their default implementation and how to correctly override them. I will also write about implement these methods using Apache Commons package’s utility classes. hashCode() and equals() methods have been defined in Object class which is parent class […]