Blog Archives

♥♦ HashMap & HashSet and how do they internally work? What is a hashing function?

HashMap is not only one of the frequently used data structures, but also one of the popular interview topics. Q1. How does a HashMap store data? A1. As key/value pairs. You can store and retrieve values with the keys. Q2. What is the HashMap lookup time in Big O notation?

Read more ›

Posted in Collection and Data structures, Objects, Understanding Core Java
Tags: ,

♥ Overloaded methods Vs Generic methods in Java with JD-GUI & javap to look under the covers

In an earlier post we looked at Understanding Overriding, Hiding, and Overloading in Java?. We also discussed how “method overriding” gives polymorphism. In this post, let’s see how a “generic method” can replace a number of overloaded methods. Then see under the hood as to what happens to the compiled

Read more ›

Posted in Generics
Tags:

04: Identifying and fixing LazyInitializationException in Hibernate

LazyInitializationException is thrown when an object becomes detached, and if you try to access associated (i.e. proxied) object(s) of a detached object. Q. What is a detached object in Hibernate? When you close an individual Hibernate Session, the persistent objects you are working with are detached. This means the object

Read more ›

Posted in Hibernate, Java Debugging
Tags:

03: Identifying and fixing NonUniqueObjectException in Hibernate

NonUniqueObjectException is thrown when there is an object already associated with the session with the same id (primary key) (i.e. a duplicate). It is important to understand the concept of a “detached” object in Hibernate. This is one of the most common errors, understanding why and when this error is

Read more ›

Posted in Hibernate, Java Debugging
Tags:

♥ Java Iterable Vs Iterator differences and know how

Q1. What are the differences between Iterator<T> Vs Iterable<T>? A1. The “Iterable” was introduced to be able to use in the “foreach” loop. A class implementing the Iterable interface can be iterated over. For example,

Hence, it can be used in the foreach loop

The Iterable interface has

Read more ›

Posted in Collection and Data structures, Differences Between X & Y
Tags:

06: ♥ Java 8 way of File reading and functionally processing the data

Output:

#1 double colon notation :: The new double colon (::) operator that Java 8 has to convert a normal method into lambda expression. So, Instead of:

You can do:

#2 Why is stream::iterator used? “lines::iterator” where iterator() is an instance method on “BaseStream<T,Stream<T>>” from which

Read more ›

Posted in IO, Java 8
Tags:

03: ♥♦ Java autoboxing & unboxing benefits & caveats interview Q&As

Q1. What do you understand by the terms “autoboxing” and “autounboxing” in Java? A1. Java automatically converts a primitive type like “int” into corresponding wrapper object class Integer. This is known as the autoboxing. When it converts a wrapper object class Integer back to its primitive type “int”, it is

Read more ›

Posted in Data types, Understanding Core Java
Tags: ,

♥♦ Java Generics in no time “? extends” & “? super” explained with a diagram

Generics in Java can be be a bit tricky to get your head around. Hope the explanation below enhances your understanding of generics. This complements 3 scenarios to get a good handle on Java generics. Plain old List, List <Object>, and List<?> The plain old List: is a heterogeneous mixture

Read more ›

Posted in Generics, Understanding Core Java
Tags: ,
Page 1 of 6123456
1100+ paid subscribers. Reviews | Free Contents. Monthly 260K+ views & 40k+ visitors. 9 tips to earn more.

Java Developer Training – 800+ Q&As ♥Free|♦FAQ (Mouse Hover for Tooltip)

open all | close all

200+ Java Developer Job Interview FAQs

open all | close all

16 Java Programmer Key Areas to be a top-notch

open all | close all

80+ Java Tutorials – Step by step

open all | close all

100+ Java Developer Coding Exercises

open all | close all

How good are your …..Java job hunting & career fast-tracking skills?

open all | close all