Last active
October 5, 2018 04:42
-
-
Save joswlv/4035eeb270f24efdcf60511521ecfc26 to your computer and use it in GitHub Desktop.
Datayanolja
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
/* | |
사용된 java version | |
java version "1.8.0_171" | |
Java(TM) SE Runtime Environment (build 1.8.0_171-b11) | |
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode) | |
*/ | |
public class Lottery { | |
@Test | |
public void Run() throws IOException { | |
//추첨 | |
List<String> candidateList = Files.lines(Paths.get("이메일_목록")).collect(Collectors.toList()); | |
pickUP(candidateList, 추첨인원).stream().forEach(System.out::println); | |
} | |
public static List<String> pickUP(List<String> lst, int n) { | |
List<String> shuffleList = new LinkedList<>(lst); | |
Collections.shuffle(shuffleList); | |
return shuffleList.subList(0, n); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment