Tagged “Java”

Design Patterns - Singleton

13 Sep, 2014

Singleton is design pattern which comes under creational pattern. Sometimes, it is important to have one instance of class or we can say, it provide single global entry point to the object.

Tags:

Design Patterns - Strategy Design Pattern

13 Sep, 2014

Strategy design pattern comes under the category behavioural pattern. It is also known as Policy pattern. It defines a family of algorithms and encapsulates each algorithm. The algorithm can be interchanged without changing much code. It bury algorithm implementation details in derived classes. It favours composition over inheritance.

Tags:

Serialization in Java

14 Sep, 2014

Serialization is the process of encoding an object to byte stream and reverse of it is called deserialization. It is platform independent process which means you can serialize the object in one JVM and can transport the object over network and/ or store it in file system and then deserialize it in other or on same JVM.

Tags:

Design Patterns - Abstract Factory design pattern

18 Sep, 2014

Abstract Factory design pattern comes under the category creational pattern. It is also called factory of factories. It provides a way to encapsulate a group of factories which have common behaviour or theme without specifying which underlying concrete objects are created. It is one level of abstraction higher than Factory pattern.

Tags:

Indexing and Searching with Apache Lucene

24 Sep, 2014

Lucene is a high-performance, scalable information retrieval (IR) library. IR refers to the process of searching for documents, information within documents, or metadata about documents. Lucene lets you add searching capabilities to your application. [ref. Apache Lucene in Action Second edition covers Apache Lucene v3.0]

Tags:

Object Cloning in Java

09 Dec, 2014

Object cloning is the process of creating exact copy of the given object. There are two pre-requisite in java; 1) implement Cloneable interface and 2) override the clone() method defined in the java.lang.Object class.

Tags:

Java 8 - Filtering with predicates

09 Jan, 2017

Object cloning is the process of creating exact copy of the given object. There are two pre-requisite in java; 1) implement Cloneable interface and 2) override the clone() method defined in the java.lang.Object class.

Tags:

Java 8 - Newly introduced java.util.function package

09 Jan, 2017

Object cloning is the process of creating exact copy of the given object. There are two pre-requisite in java; 1) implement Cloneable interface and 2) override the clone() method defined in the java.lang.Object class.

Tags:

Java 8 - Iterating collections and maps with "forEach", Consumer and BiConsumer

11 Jan, 2017

Java 8 introduced new way of iterating Collections API. It is retrofitted to support forEach method which accepts Consumer in case of Collection and BiConsumer in case of Map.

Tags:

Comparing Apache Avro vs Java Serialization

20 Jan, 2017

I did run a comparsion of Apache Avro v/s Java Serialization. Apache Avro consumed 15-20 times less memory to store the serialized data. I created a class with three fields (two String and one enum and serialized them with Avro and Java.

Tags:

Java 8 - Lambda expressions

23 Jan, 2017

Java 8 reincarnated SAM interfaces and termed them Functional interfaces. Functional interfaces have single abstract method and are eligible to be represented with Lambda expression.

Tags:

Java 8 - What are functional interfaces?

23 Jan, 2017

Java 8 reincarnated SAM interfaces and termed them Functional interfaces. Functional interfaces have single abstract method and are eligible to be represented with Lambda expression.

Tags:

Java 8 - Aggregate operations on Streams

01 Feb, 2017

You can perform intermediate and terminal operations on Streams. Intermediate operations result in a new stream and are lazily evaluated and will start when terminal operation is called.

Tags:

Java 8 - Streams in action

01 Feb, 2017

Java 8 introduced new package java.util.stream which contains classes to perform SQL-like operations on elements. Stream is a sequence of elements on which you can perform aggregate operations (reduction, filtering, mapping, average, min, max etc.).

Tags:

Java 8 - What are method and constructor references?

02 Feb, 2017

Method references are the special form of Lambda expression. When your lambda expression are doing nothing other than invoking existing behaviour (method), you can achieve same by referring it by name.

Tags:

Java 8 - What are default and static methods in interface?

23 Aug, 2018

Java 8 introduced default and static methods in interfaces. These features allow us to add new functionality in the interfaces without breaking the existing contract for implementing classes.

Tags:

See all tags.