Java forEach Example Using Lambda Expression

Introduction This tutorial will show you how to use Java 8 forEach() loop to iterate Collection using Lambda Expression. Prior to Java 8 or JDK 8, the for loop was used as a for-each style but in Java 8 the inclusion of forEach() loop simplifies the iteration process in mainly one line.

Java Lambda Expressions

Introduction When implementation of anonymous class is very simple, for example, an interface contains only one method, then the syntax of anonymous classes may seem unclear. In this situation the functionality is passed as an argument to another method to perform an action, for example, when someone clicks on a button. Lambda expressions enable to treat functionality as a method…

Java Anonymous Class

A class that has no name is known as anonymous class. Java Anonymous class can be created in two ways: Class Interface For more information please read https://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html#accessing Anonymous classes enable you to make your code more concise. They enable you to declare and instantiate a class at the same time. They are like local classes except that they do…

BlockingQueue in Java

Blocking Queue A blocking queue is a queue that blocks when you try to dequeue an empty queue, or if you try to enqueue an item in a full queue. Dequeue means when you take an item out of a queue. Enqueue means when you put an item into a queue. A thread trying to dequeue an empty queue is…

JSP Custom Tag Library

We will see here how to create JSP custom tag library. We know JSP tags simplify JSP page development and maintenance works in our day-to-day life. JSP technology also provides a mechanism for encapsulating other types of dynamic functionality in custom tags, which are extensions to the JSP language.

Deal With Empty Or Blank Cell In Excel File Using Apache POI

Empty/Blank Cell This tutorial will show you how you can deal with empty or blank cell in excel file using Apache POI. You won’t be able to handle blank or empty cell if you use cell iterator, so you have to get the maximum cell index for the row and iterate through index to deal with empty cell. Related Posts:…

Check a given date is first day of month using Joda API

Introduction In this post, I will show you how to check whether a given date is first day of the month using Joda API. Joda API is a date time API which provides useful methods for data and time management in Java applications.

Junit’s annotation based expected exception testing

Junit provides an option of tracing exception thrown by a Java method. There are different ways of handling exceptions in JUnit tests. Standard Junit’s org.junit.Test annotation offers expected attribute that allows you specifying the a Throwable to cause a test method to succeed if an exception of the specified class is thrown by the method. A Java unit test should…

Create archive or zip using Java

With this example I will show you how to create an archive or zip from multiple files using Java language. If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Generic Way of Writing Data to Multiple Sheets in Excel using Apache POI

Introduction With this example I will show you how to create an excel file and write a list of objects to multiple sheets in excel file using Apache POI in Java language. In this file I am going to show generic way of writing data to multiple sheets in excel using Apache POI and Java. In this example I am…