Arraylist to Array Using ToArray() in java

Syntax: <T> T[] toArray(T[] a) Eg : String[] y = x.toArray(new String[0]); T – the runtime type of the array to contain the collection Parameters: a – the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose. Returns: an array […]

182 total views, 6 views today

» Read more

hashMap Vs TreeMap Vs LinkedHashMap

════════════╦═════════════════════╦═══════════════════╦═════════════════════╗ ║ Property ║ HashMap ║ TreeMap ║ LinkedHashMap ║ ╠══════════════╬═════════════════════╬═══════════════════╬═════════════════════╣ ║ Iteration ║ no guarantee order ║ sorted according ║ ║ ║ Order ║ will remain constant║ to the natural ║ insertion-order ║ ║ ║ over time ║ ordering ║ ║ ╠══════════════╬═════════════════════╬═══════════════════╬═════════════════════╣ ║ Get/put ║ ║ ║ ║ ║ remove ║ O(1) ║ O(log(n)) ║ O(1) ║ ║ containsKey […]

186 total views, 4 views today

» Read more

Why StringBuffer/StringBuilder should be avoided in HashMap?

Why StringBuffer/StringBuilder should be avoided in HashMap?   This is one of the core java interview question under collections category. Generally in all the map manipulations we use string and avoid stringbuffer and stringbuilders, because both are mutable. What is the issue if is mutable ? If you are keeping your hashmap’s key/value as stringbuilder/stringbuffer then once after you inserted […]

260 total views, 1 views today

» Read more

Generate angular + Java code using yeoman & Jhipster

Generate angular + Java code using yeoman & Jhipster Ensure you have installed yeoman (yo when dealing with npm and yarn) and jhipster (generator-jhipster when dealing with npm and yarn). If not installed, have a quick look at,     Step 1: Run yo jhipster     It will ask around 10 to 15 questions, you can provide the sample […]

426 total views, 1 views today

» Read more

Core Java Programming Interview Questions

Core Java Programming Interview Questions: All these below are purely java programming interview questions collected from different attendees and different companies. Walk through all the programming questions and try to figure it out before checking the answers below.   Basics:   1.What is the output ? package in.javadomain; class Basics { public static void main(String[] args) { System.out.println(“I am main […]

365 total views, 2 views today

» Read more

Java program to check whether the String is Pangram or Not

Java program to check whether the String is Pangram or Not: What is Pangram ? If a given sentence has all the alphabets then it is a valid pangram.   If the below sentence is given as input then it has to return “Pangram” The quick brown fox jumps over the lazy dog   If the below sentence is given […]

492 total views, 2 views today

» Read more

Reflection Example for 100% Dummies

Reflection Example for 100% Dummies: I know in all the recent interviews reflection relation question are asked along with the other tough and popular core java interview questions mentioned here.   As mentioned in the title this is purely for 100% dummies who just heard only the term “Reflection”. I was also in the list of 100% dummies, after reading […]

247 total views, no views today

» Read more

Java Remote Debugging Web Application Steps

Java Remote Debugging Web Application Steps: Java web applications are complex to setup and do debugging all the time for all the issues. In those cases, we can smartly keep the code deployed currently in local and just do remote debugging to figure out the issues. It is much easy with IBM WebSphere or Eclipse. Step 1: Add these two […]

323 total views, no views today

» Read more

Java Collection Framework (As per Java 8) All Covered in One Image

Java Collection Framework (As per Java 8) All Covered in One Image: Even many experienced java developers know only list/set/map and few know vector hashtable and queues. But so much more than that are actually there in the java collection framework. I am publishing the single java collection framework image to understand the complete collection hierarchy interface/sub interface and its […]

386 total views, 1 views today

» Read more

Binary Search Implementation in Java Example

Binary search is one of the most important searching algorithm to know and understand for search functionality. In the below we are going to return the array position based on the searching number existence in the array, if it does not exist then we will return -1.   Binary search basically works this way, 1. Numbers should be sorted in […]

365 total views, no views today

» Read more
1 2 3 21