Copy file in Java

In this tutorial, we will cover how to copy any file in Java. If you consider Java 6 or earlier, Java does not have an object or method that supports us copying a file, only creating or deleting a file. So if you are working… Read More

Delete file in Java

Even though creating a file in Java is easy, deleting a file is easier. In this tutorial, I will guide you how to delete a file in Java. The File object, which is the main file management object since Java version 6 and earlier, cannot be… Read More

Create file in Java

Creating files in Java is a basic operation, everyone must know. So, in this tutorial, I just synthesized the ways that we can create a file in Java. Maybe it is useful for beginners of Java programming. First, I have to mention the File object.… Read More

Method iterate() of Stream object in Java

In Java 8, the iterate() method has been introduced and it has only two parameters and will help us to create an infinite stream. Content:

Example:

When running the above example, you will see that a Stream object contains endless numbers beginning at… Read More

Method ofNullable() of Stream object in Java

This method was added from Java 9.

This method will return the Stream object of an element in case this element is not null; if it is null, it returns an empty Stream. Example:

When you run the above code, it will print… Read More

Method dropWhile() of Stream object in Java

This method was added from Java 9.

This method also has the parameter Predicate interface and its function is the opposite of the takeWhile() method. This method also passes each element in your Stream object from left to right and ignores all elements that… Read More

Method takeWhile() of Stream object in Java

This method was added from Java 9.

The parameter of this method is the Predicate interface and this method takes the elements in your Stream object from left to right, until the condition of the Predicate object is no longer fulfilled. Example:

In… Read More