Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package com.company;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int array[] = {1,2,1,2,3,3};
System.out.println(isConsecutive());
}
private static Boolean isConsecutive(int array[]) {
return Arrays
.stream(array)
.mapToLong(Long::new)
.distinct()
.sum() == array.length;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.