Merge pull request #5528 from eugenp/fix-bubble-sort

fix bubble sort
This commit is contained in:
Loredana Crusoveanu
2018-10-24 22:50:10 +03:00
committed by GitHub
2 changed files with 3 additions and 3 deletions
@@ -7,7 +7,7 @@ public class BubbleSort {
void bubbleSort(Integer[] arr) {
int n = arr.length;
IntStream.range(0, n - 1)
.flatMap(i -> IntStream.range(i + 1, n - i))
.flatMap(i -> IntStream.range(1, n - i))
.forEach(j -> {
if (arr[j - 1] > arr[j]) {
int temp = arr[j];
@@ -1,8 +1,8 @@
package com.baeldung.algorithms.bubblesort;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import org.junit.Test;
import org.junit.jupiter.api.Test;
public class BubbleSortUnitTest {