Skip to content

Instantly share code, notes, and snippets.

@z11i
Created February 6, 2016 13:08
Show Gist options
  • Save z11i/9ebf5bc8711f5c0e34e9 to your computer and use it in GitHub Desktop.
Save z11i/9ebf5bc8711f5c0e34e9 to your computer and use it in GitHub Desktop.
Remove duplicates in an array while maintaining the original order
import java.util.*;
public class UniqueArray {
public static int[] unique(int[] integers) {
return Arrays.stream(integers).distinct().toArray();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment