-
-
Save siosio/08b86d3344e198760e23 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 gist; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Random; | |
import java.util.function.Supplier; | |
import java.util.stream.Collectors; | |
public class BonJobi { | |
public static void main(String[] args) throws Exception { | |
genBonjovi(); | |
} | |
private static void genBonjovi() throws Exception { | |
List<String> input = Arrays.asList("ジョ", "ン", "ボ", "ヴィ"); | |
StringBuilder result = new StringBuilder(); | |
Supplier<String> supplier = () -> new Random().ints(0, input.size()) | |
.limit(2) | |
.mapToObj(input::get) | |
.collect(Collectors.joining()); | |
int count = 0; | |
while (!result.append(supplier.get()).toString().endsWith("ジョン・ボン・ジョヴィ")) { | |
count++; | |
result.append('・'); | |
} | |
System.out.println(result); | |
System.out.println(count + " Bon Jovis"); | |
System.out.println("\n" + | |
" _人人人人人人人人人人人人人人_\n" + | |
" > You Give Love a Bad Name <\n" + | |
"  ̄Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y ̄"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment