Write a program to count the occurrences of an element in an array is one of the basic question which will be asked in a Java Interview. After the introduction of Collection framework performing this operation is a pretty easy task. Let see how we can count the occurrence using HashMap. … [Read more...]
How to Convert Array to ArrayList in Java?
This is one of the popular questions in the Java world. I have encountered this situation a lot of times in my life which made me write this article on converting a Java Array to ArrayList. Almost everybody knows that the Arrays are used to store primitive data types and ArrayList is used to store the Objects. Let's see the different ways to convert. … [Read more...]