Skip to content

Instantly share code, notes, and snippets.

View snarkbait66's full-sized avatar

T Sanford snarkbait66

  • Sacramento, CA
View GitHub Profile
@stuart-marks
stuart-marks / FizzBuzz.java
Created March 20, 2014 04:11
Yet another FizzBuzz, using Java 8 lambda and streams.
import java.util.function.IntFunction;
import java.util.stream.IntStream;
public class FizzBuzz {
static <R> IntFunction<R> ifmod(int m, R r, IntFunction<R> f) {
return (int i) -> (i % m == 0) ? r : f.apply(i);
}
public static void main(String[] args) {
IntStream.rangeClosed(1, 100)