Home » Core Java

Core Java

Java Command Design Pattern Example

1. Introduction to Java Command Design Pattern In this post, we will discuss the concept java Command design pattern. The command design pattern is one of the behavioral design pattern in object oriented programming where the object is used to hide the information that is necessary to carry out an action or to activate events later. This data involves the ...

Read More »

Java Strategy Design Pattern Example

1. Introduction to Java Strategy Design Pattern In this article, we will elaborate java Strategy design pattern in detail which is one of the important behavioral design pattern. The Strategy design pattern is also referred to as a policy pattern which allows the selection of an algorithm at runtime as needed. We define several algorithms or strategies in the java strategy ...

Read More »

Java State Design Pattern Example

1. Introduction to Java State Design Pattern In this article, we will introduce java state design pattern in detail. The java State design pattern is one of the behavioural design pattern. When an object changes its behavior based on its internal state, the State design pattern is used. So, we create objects in a State design pattern that represent different ...

Read More »

Java Template Design Pattern Example

1. Introduction to Java Template Design Pattern In this post, we will discuss and elobarate the java template design pattern in detail. Java Template design pattern is one of the important behavioral design pattern. Template design pattern describes algorithm steps and can provide default implementations common to most or all of the subclasses. Let’s get an example to understand and ...

Read More »

Java 8 Functional Programming Tutorial

Java 8 supports functional programming via the lambda expression and Stream API. In this tutorial, I will demonstrate how Java 8 supports functional programming via common pre-defined functional interfaces, Collections, and Stream API. Table Of Contents 1. Introduction 2. Technologies Used 2.1 Maven Project 3. Java 8 Predefined Functional Interfaces 3.1 Function 3.2 Predicate 3.3 Supplier 3.4 Consumer 3.5 UnaryOperator ...

Read More »

Java Memento Design Pattern Example

1. Introduction to Java Memento Design Pattern In this article, we will discuss about one of the java design pattern – Java Memento Design Pattern. Memento design pattern is one of behavioural design patterns. Memento design pattern is mostly used when we like to save an object’s condition so that we can restore it later. Let us look deeply into ...

Read More »

Java Prototype Design Pattern Example

1. Introduction to Java Prototype Design Pattern In this article, we would be discussing in depth the Java Prototype Design pattern. Java Prototype Design pattern is a creational design pattern that provides a way of prototyping objects of similar nature. In Java, the creation of objects is an expensive job in terms of the processing power being consumed. In case ...

Read More »

Java 8 Format LocalDateTime Example

1. Introduction Java 8 Date-time API provides a java.time.LocalDateTime class which is an immutable date-time object and often is viewed as a year-month-day-hour-minute-second format. It contains a java.time.format package to handle the formatting of dates and times. This package includes three classes: DateTimeFormatter – to print and parse date-time objects. It provides common formatting constants as well as a string ...

Read More »

Java Abstract Factory Design Pattern Example

1. Introduction In this article, we will depict Java Abstract Factory Design Pattern in detail. The Abstract configuration design, as its name proposes, is by all accounts an abstract class based method to allow creation of object factories with a template class that guides the development. Abstract Factory design pattern is specifically useful to build a class that explains how ...

Read More »

Java 8 Compare Dates Example

1. Introduction Java 8 added a new set of packages to provide a comprehensive date-time model. Java 8 Date-Time API is a JSR-310 implementation. There are several interfaces: ChronoLocalDate, ChronoLocalDateTime, ChronoZonedDateTime in java.time.chrono packages. They all have isBefore, isAfter, isEquals, and compareTo methods to compare two dates. Java 8 date classes: java.time.LocalDate, java.time.LocalDateTime, java.time.Instant, java.time.ZonedDateTime, java.time.chrono.JapaneseDate, java.time.chrono.MinguoDate, etc implement these ...

Read More »