本文整理匯總了Java中com.google.common.collect.ImmutableMultiset.entrySet方法的典型用法代碼示例。如果您正苦於以下問題:Java ImmutableMultiset.entrySet方法的具體用法?Java ImmutableMultiset.entrySet怎麽用?Java ImmutableMultiset.entrySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.ImmutableMultiset
的用法示例。
在下文中一共展示了ImmutableMultiset.entrySet方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: identifyDuplicates
import com.google.common.collect.ImmutableMultiset; //導入方法依賴的package包/類
private void identifyDuplicates(List<ModContainer> mods)
{
TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
for (ModContainer mc : mods)
{
if (mc.getSource() != null)
{
dupsearch.put(mc, mc.getSource());
}
}
ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
SetMultimap<ModContainer, File> dupes = LinkedHashMultimap.create();
for (Entry<ModContainer> e : duplist.entrySet())
{
if (e.getCount() > 1)
{
FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement()));
dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
}
}
if (!dupes.isEmpty())
{
throw new DuplicateModsFoundException(dupes);
}
}
示例2: determinePayOutPercentage
import com.google.common.collect.ImmutableMultiset; //導入方法依賴的package包/類
/**
* Method should return the number of times an occurrence of a reel
*
* @param reels
* @return
*/
static int determinePayOutPercentage(List<String> reels) {
Multiset<String> reelCount = HashMultiset.create();
reelCount.addAll(reels);
// order the number of elements by the higest
ImmutableMultiset<String> highestCountFirst = Multisets.copyHighestCountFirst(reelCount);
int count = 0;
for (Entry<String> entry : highestCountFirst.entrySet()) {
count = entry.getCount();
break;
}
return count;
}
示例3: writePropertiesFile
import com.google.common.collect.ImmutableMultiset; //導入方法依賴的package包/類
static void writePropertiesFile(Scenario scen,
GeneratorSettings settings, double actualDyn, long seed,
String fileName) {
final DateTimeFormatter formatter = ISODateTimeFormat
.dateHourMinuteSecondMillis();
final VanLon15ProblemClass pc = (VanLon15ProblemClass) scen
.getProblemClass();
final ImmutableMap.Builder<String, Object> properties = ImmutableMap
.<String, Object>builder()
.put("problem_class", pc.getId())
.put("id", scen.getProblemInstanceId())
.put("dynamism_bin", pc.getDynamism())
.put("dynamism_actual", actualDyn)
.put("urgency", pc.getUrgency())
.put("scale", pc.getScale())
.put("random_seed", seed)
.put("creation_date", formatter.print(System.currentTimeMillis()))
.put("creator", System.getProperty("user.name"))
.put("day_length", settings.getDayLength())
.put("office_opening_hours", settings.getOfficeHours());
properties.putAll(settings.getProperties());
final ImmutableMultiset<Class<?>> eventTypes = Metrics
.getEventTypeCounts(scen);
for (final Multiset.Entry<Class<?>> en : eventTypes.entrySet()) {
properties.put(en.getElement().getSimpleName(), en.getCount());
}
try {
Files.write(
Paths.get(fileName + ".properties"),
asList(Joiner.on("\n").withKeyValueSeparator(" = ")
.join(properties.build())),
Charsets.UTF_8);
} catch (final IOException e) {
throw new IllegalStateException(e);
}
}