Created
August 22, 2019 16:50
-
-
Save cosminpopescu14/473318af8f71d4e68426e59a07953cf9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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