Skip to content

Instantly share code, notes, and snippets.

@ruimo
Created July 31, 2015 08:20
Show Gist options
  • Save ruimo/8975ef4c013975929991 to your computer and use it in GitHub Desktop.
Save ruimo/8975ef4c013975929991 to your computer and use it in GitHub Desktop.
Java8だと型推論してくれないケース。
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
public class Test {
static final ImmutableMap<String, Function<Void, Integer>> factories =
ImmutableMap.builder()
.put("Hello",
new Function<Void, Integer>() {
@Override
public Integer apply(Void arg) {
return 100;
}
})
.build();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment