General FizzBuzz: Difference between revisions
Content added Content deleted
Line 1,830: | Line 1,830: | ||
*/ |
*/ |
||
public static void main(String[] args) { |
public static void main(String[] args) { |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
List<Function<Integer,String>> cycle_functions = Stream.of(args) |
|||
⚫ | |||
⚫ | |||
.map(make_cycle_function::apply) |
|||
.collect(Collectors.toList()); |
|||
Function<Integer,String> moduloTesters = i -> cycle_functions.stream() |
Function<Integer,String> moduloTesters = i -> cycle_functions.stream() |
||
.map(fcn->fcn.apply(i)) |
.map(fcn->fcn.apply(i)) |
||
.collect(Collectors.joining()); |
.collect(Collectors.joining()); |
||
BiFunction<Integer,String,String> formatter = |
|||
⚫ | |||
Function<Integer,String> fizzBuzz = i -> formatter.apply(i,moduloTesters.apply(i)); |
Function<Integer,String> fizzBuzz = i -> formatter.apply(i,moduloTesters.apply(i)); |
||
⚫ | |||
.forEach(arg->{ |
|||
⚫ | |||
⚫ | |||
}); |
|||
IntStream.rangeClosed(0,Integer.parseInt(args[args.length-1])) |
IntStream.rangeClosed(0,Integer.parseInt(args[args.length-1])) |
||
.mapToObj(Integer::valueOf) |
.mapToObj(Integer::valueOf) |