Recently I stumble on one of the Java interview questions: “Implement List-Recently-Used (LRU) Cache using Java collection class?” If you have worked on similar problem before, then it is really easy for you. Otherwise you start thinking about the best collection class to implement LRU cache. Most of the people fail to recognize that LinkedHashMap […]

,

Developers often get into dilemma when they have to convert the object to string representation by choosing between valueOf() and toString() method. Because both the methods do the same thing but in a bit different ways. To give you more context, toString() method is present in Object class and generally overridden in the derived class […]

,

As we know regular expression is a very handy tool to processing the string. It really saves your coding and very nested if-else statements. But when you run your application on resource sensitive system then you may want to carefully choose the tools to use. ¬†Initially I thought regular expression would equal or less time […]

, ,

As I have mention in my previous post that hashCode() and eqauls() implementation are basic concepts of Java and any developer should know about these while using Collection classes. These are important concepts and even asked in technical interviews. When equals() method is implemented it is also necessary to implement hashCode() method. In this post, […]

, ,

There are two methods hashCode() and equals() present in Object class which are important and should be implemented in class. A Java developer should know the basic concept behind these methods. And sometimes even in technical interview questions are asked related to these. This get more important when object is used in hash based Collection […]

, , ,

We often need to search for java class file in given jar files to make sure that the class is present. Or sometimes it may happened that you reference the class in your java code but while compilation you don’t know which jar should be included in the compile time dependencies. There is also jarscan […]

, ,