Skip to content

Instantly share code, notes, and snippets.

@yuri-adeodato
yuri-adeodato / BubbleSort.java
Last active July 26, 2018 13:37 — forked from m-x-k/BubbleSort.java
Java 8 bubble sort integer array example using predicates for acending and descending options
import java.util.Arrays;
import java.util.Random;
import java.util.function.Predicate;
public class BubbleSort {
private int[] sort(int[] array, Predicate<Integer> sortType) {
boolean sorted = false;
int temp;
while (!sorted) {