This file contains hidden or 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
public static void main(String[] args) { | |
int all = 1000000; | |
Map<Integer, Integer> results = Maps.newHashMap(); | |
for (int i = 0; i < all; i++) { | |
int id = chanceSelect(couponProbability); | |
if (!results.containsKey(id)) { | |
results.put(id, 0); | |
} | |
results.put(id, results.get(id) + 1); | |
} |
This file contains hidden or 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
# This config file was created for myself (@dan). | |
# You may want to add or remove some rules to make efficient use of the Internet. | |
# This file depends on the proxy.conf which defines your own proxy. | |
# Your proxy.conf will look like this: | |
# ---- START ---- | |
# #!PROXY-OVERRIDE:rules.conf | |
# [Proxy] | |
# Proxy = https,server.address,port,username,password | |
# ---- END ---- |
This file contains hidden or 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
// In the latest version(12.0) of guava there will be a class named FluentIterable. | |
// This class provides the missing fluent API for this kind of stuff. | |
final Collection<String> filtered = FluentIterable | |
.from(tokens) | |
.transform(new Function<String, String>() { | |
@Override | |
public String apply(final String input) { | |
return input == null ? "" : input.trim(); |
NewerOlder