Java 8 BiPredicate Examples
In Java 8, BiPredicate is a functional interface, which accepts two arguments and returns a boolean, basically this BiPredicate is same with the Predicate, instead, it takes 2 arguments for…
Favourite tutorials for developers
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need to recompile.
In Java 8, BiPredicate is a functional interface, which accepts two arguments and returns a boolean, basically this BiPredicate is same with the Predicate, instead, it takes 2 arguments for…
In Java 8, Predicate is a functional interface, which accepts an argument and returns a boolean. Usually, it used to apply in a filter for a collection of objects.
In Java 8, Consumer is a functional interface; it takes an argument and returns nothing. It can act as Higher Order Function, so we can accepts Consumer as an argument,…
In Java 8, we can use the new forEach to loop or iterate a Map, List, Set, or Stream. Review the forEach method signature, it accepts a functional interface Consumer.…
Different operating system has a different new line or line separator string: UNIX, Linux or Mac OSX = \n, Windows = \r\n . We can also use the Java 1.7…
Before Java 7, we can close a resource with finally. In Java 7, a new try-with-resources approach is introduced, it helps to close resources automatically.
Long live the Scanner class, a few examples for self-reference.
In Java, there are three ways to read input from a console : 1 - System.console (JDK 1.6), 2 - Scanner (JDK 1.5), 3 - BufferedReader + InputStreamReader (Classic). Since…
A quick example to show you how to read the standard input in Java.
Here’s an example to check if a directory is empty.