Home » Java 8

Tag Archives: Java 8

How to find a Bipartite Graph?

Bipartite Graph

Hello there, in this article we will show how to find if a graph is a Bipartite Graph through detailed examples. 1. Introduction In this article, we will define a bipartite graph, explore the properties of a bipartite graph, document an algorithm used to determine whether a graph is bipartite or not, and implement this algorithm in Java. Finally, we ...

Read More »

Radix Sort in Java

Bipartite Graph

1. Introduction Sorting algorithms were devised in order to make the ordering of elements of a list or array possible. There are many available to choose from, such as Bubble Sort, Quick Sort, Selection Sort, Heap Sort, Merge Sort, just to name a few. Radix Sort is a sorting algorithm that just happens to be fairly efficient. This article will ...

Read More »

Collectors to Map in Java

Bipartite Graph

1. Introduction The Collectors class is in the java.util.stream package. The Collectors class contains static methods which return a Collector to allow for various reduction operations. This article will discuss the toMap and the toConcurrentMap methods. These methods will return a Map or a ConcurrentMap. In addition, we will also be discussing the SortedMap interface. Finally, we conclude this article ...

Read More »

Java 8 CompletableFuture thenRun Example

Bipartite Graph

Hello. In this tutorial, we will explore the Java 8 CompletableFuture thenRun method. 1. Introduction Before diving deep into the practice stuff let us understand the thenRun(…) method we will be covering in this tutorial. CompletableFuture.thenRun() method does not depend on the previous execution CompletableFuture.thenRun() method does not return anything i.e. CompletableFuture<Void> 2. Practice Let us dive into some practice ...

Read More »

Java 8 CompletableFuture thenAccept Example

Bipartite Graph

Hello. In this tutorial, we will explore the Java 8 CompletableFuture thenAccept method. 1. Introduction Before diving deep into the practice stuff let us understand the thenAccept(…) method we will be covering in this tutorial. CompletableFuture.thenAccept() takes a Consumer and returns CompletableFuture 2. Practice Let us dive into some practice stuff from here and I am assuming that you already ...

Read More »

Java 8 CompletableFuture thenApply Example

Bipartite Graph

Hello. In this tutorial, we will explore the Java 8 CompletableFuture thenApply method. 1. Introduction Before diving deep into the practice stuff let us understand the thenApply(…) method we will be covering in this tutorial. CompletableFuture.thenApply(…) method is inherited from the CompletionStageThe method returns a new CompletionStage (is a Promise object) that when the stage is completed normally, is executed ...

Read More »

Java 8 CompletableFuture supplyAsync Example

Bipartite Graph

Hello. In this tutorial, we will explore the Java 8 CompletableFuture and explain the supplyAsync method. 1. Introduction Before diving deep into the practice stuff let us understand the supplyAsync(…) method we will be covering in this tutorial. Run a Supplier functional interface asynchronously. A Supplier functional interface does not accept anything but returns a valueThe completableFuture.get() blocks until the ...

Read More »

Java 8 CompletableFuture runAsync Example

Bipartite Graph

Hello. In this tutorial, we will explore the Java 8 CompletableFuture and explain the runAsync method. 1. Introduction Before diving deep into the practice stuff let us understand the runAsync(…) method we will be covering in this tutorial. Used to run a method asynchronously. The method accepts a Runnable functional interface The method does not return any value Supports the ...

Read More »

Java 8 Stream API – limit() & skip() Example

Bipartite Graph

Hello. In this tutorial, we will explore the Stream API: limit() and skip() methods introduced in Java 8. 1. Introduction Before diving deep into the practice stuff let us understand the methods we will be covering in this tutorial. The skip() method discards the first n elements of a stream. n cannot be a negative number and if it is ...

Read More »

Java 8 Stream API – distinct(), count() & sorted() Example

Bipartite Graph

Hello. In this tutorial, we will explore the Stream API methods: sorted(), count(), and distinct() methods introduced in Java 8. 1. Introduction Before diving deep into the practice stuff let us understand the methods we will be covering in this tutorial. The distinct() method returns a stream of unique elements. It is a stateful intermediate operation and returns a new ...

Read More »