Strategy Pattern

This pattern is listed in Behavioral pattern which allows you to define sets of algorithms in the parent class which will be extended by sub classes in which all the given algorithms are interchangeable. The best way to observe this pattern is to study the below example. public abstract class Employee { public abstract int

Forwarding to a page from controller

This is very useful when you compare that a passed object is null in the forthcoming controller you may directly forward user to a different page or maybe assign a message regarding the issue that the user had faced this error it depends on your development favorite FacesContext.getCurrentInstance().getExternalContext().redirect(“index.jsf”);  

Passing objects between managed beans&controllers

in the source controller add your object into faces session map interface and identify it with a name FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(“category”, category); then in the target controller to acquire the object do the following Category category = (Category) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(“category”);

Java Lambda Expressions Collections Example

I was wondering new features in Java 8 and wanted to play around with Lambda expressions. So I’ve eventually ended up preparing some collection examples. Hope you’ll easily summarize and understand it The Code package com.oracle.lambda; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Predicate; public class CollectionExample { public static void main(String[] args) { List<Developers>

Interfaces Versus Abstract Classes

While you use an interface to specify the form that something must have, it does not actually provide the implementation for it. In this sense, an interface is a like an abstract class. The abstract class must be extended in exactly the manner that its abstract methods specify. An interface differs from an abstract class

Forms of Inheritance

Timothy Budd, in his book “Understanding Object-Oriented Programming with Java” (Addison-Wesley, 2000), makes the following distinction: The term subtype is used to describe the relationship between types that explicitly recognizes the principle of substitution. That is, a type B is considered to be a subtype of A if two conditions hold. The first is that