本文整理汇总了Java中com.google.common.collect.HashMultimap.create方法的典型用法代码示例。如果您正苦于以下问题:Java HashMultimap.create方法的具体用法?Java HashMultimap.create怎么用?Java HashMultimap.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.HashMultimap
的用法示例。
在下文中一共展示了HashMultimap.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bepaalActueleRecords
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
private Multimap<MetaObject, MetaRecord> bepaalActueleRecords(final MetaObject persoonObject) {
final Multimap<MetaObject, MetaRecord> records = HashMultimap.create();
persoonObject.accept(new ParentFirstModelVisitor() {
@Override
protected void doVisit(final MetaRecord record) {
final VerantwoordingCategorie verantwoordingCategorie = record.getParentGroep().getGroepElement().getVerantwoordingCategorie();
final BooleanSupplier actueelActieRecord = () -> verantwoordingCategorie == VerantwoordingCategorie.A
&& record.getActieVerval() == null && record.getDatumEindeGeldigheid() == null;
final BooleanSupplier actueelDienstRecord = () -> verantwoordingCategorie == VerantwoordingCategorie.D
&& record.getDatumTijdVerval() == null;
if (verantwoordingCategorie == VerantwoordingCategorie.G || actueelActieRecord.getAsBoolean() || actueelDienstRecord.getAsBoolean()) {
records.put(record.getParentGroep().getParentObject(), record);
}
}
});
return records;
}
示例2: SoundManager
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
public SoundManager(SoundHandler p_i45119_1_, GameSettings p_i45119_2_)
{
this.invPlayingSounds = ((BiMap)this.playingSounds).inverse();
this.playingSoundPoolEntries = Maps.<ISound, SoundPoolEntry>newHashMap();
this.categorySounds = HashMultimap.<SoundCategory, String>create();
this.tickableSounds = Lists.<ITickableSound>newArrayList();
this.delayedSounds = Maps.<ISound, Integer>newHashMap();
this.playingSoundsStopTime = Maps.<String, Integer>newHashMap();
this.sndHandler = p_i45119_1_;
this.options = p_i45119_2_;
try
{
SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
}
catch (SoundSystemException soundsystemexception)
{
logger.error(LOG_MARKER, (String)"Error linking with the LibraryJavaSound plug-in", (Throwable)soundsystemexception);
}
}
示例3: createPermissions
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
/**
* Create permissions, note that permissionType + targetId should be unique
*/
@Transactional
public Set<Permission> createPermissions(Set<Permission> permissions) {
Multimap<String, String> targetIdPermissionTypes = HashMultimap.create();
for (Permission permission : permissions) {
targetIdPermissionTypes.put(permission.getTargetId(), permission.getPermissionType());
}
for (String targetId : targetIdPermissionTypes.keySet()) {
Collection<String> permissionTypes = targetIdPermissionTypes.get(targetId);
List<Permission> current =
permissionRepository.findByPermissionTypeInAndTargetId(permissionTypes, targetId);
Preconditions.checkState(CollectionUtils.isEmpty(current),
"Permission with permissionType %s targetId %s already exists!", permissionTypes,
targetId);
}
Iterable<Permission> results = permissionRepository.save(permissions);
return FluentIterable.from(results).toSet();
}
示例4: deserialize
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
@Override
public SetMultimap<String, String> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
SetMultimap<String, String> map = HashMultimap.create();
JsonObject filters = json.getAsJsonObject();
for (Map.Entry<String, JsonElement> filter : filters.entrySet())
{
String name = filter.getKey();
JsonArray values = ((JsonArray)filter.getValue());
for (JsonElement value : values)
{
map.put(name, value.getAsString());
}
}
return map;
}
示例5: rateMatrix
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
/**
* retrieve a rating matrix from the tensor. Warning: it assumes there is at most one entry for each (user, item)
* pair.
*
* @return a sparse rating matrix
*/
public SparseMatrix rateMatrix() {
Table<Integer, Integer, Double> dataTable = HashBasedTable.create();
Multimap<Integer, Integer> colMap = HashMultimap.create();
for (TensorEntry te : this) {
int u = te.key(userDimension);
int i = te.key(itemDimension);
dataTable.put(u, i, te.get());
colMap.put(i, u);
}
return new SparseMatrix(dimensions[userDimension], dimensions[itemDimension], dataTable, colMap);
}
示例6: getAnnotationAsMap
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
public static Multimap<String, String> getAnnotationAsMap(org.jboss.forge.roaster.model.Annotation<?> annotation,
Class<? extends Annotation> type) {
if(annotation == null) return null;
List<Method> methods = getAnnotationAttributes(type);
Multimap<String, String> result = HashMultimap.create();
for (Method method : methods) {
String name = method.getName();
boolean array = method.getReturnType().isArray();
String value = annotation.getLiteralValue(name);
if(StringUtils.isBlank(value)) continue;
String [] values = array
? annotation.getStringArrayValue(name) : new String[]{annotation.getStringValue(name)};
if(allElementsNull(values)) continue;
result.putAll(name, Arrays.asList(values));
}
return result;
}
示例7: JarIndex
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
public JarIndex() {
m_obfClassEntries = Sets.newHashSet();
m_nonePkgClassEntries = Sets.newHashSet();
m_translationIndex = new TranslationIndex();
m_access = Maps.newHashMap();
m_fields = HashMultimap.create();
m_behaviors = HashMultimap.create();
m_methodImplementations = HashMultimap.create();
m_behaviorReferences = HashMultimap.create();
m_fieldReferences = HashMultimap.create();
m_innerClassesByOuter = HashMultimap.create();
m_outerClassesByInner = Maps.newHashMap();
m_anonymousClasses = Maps.newHashMap();
m_bridgedMethods = Maps.newHashMap();
}
示例8: getAttributeModifiers
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot,
ItemStack stack) {
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER,
"Weapon modifier", (double) 3.0F + this.getAttackDamage(stack), 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER,
"Weapon modifier", (double) (-2.4000000953674316D + getEfficiencyMod(stack)), 0));
}
return multimap;
}
示例9: extractGeneratedReferences
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
private Multimap<ReferenceInfo, GeneratedReferenceInfo> extractGeneratedReferences(DocTableInfo tableInfo) {
Multimap<ReferenceInfo, GeneratedReferenceInfo> multiMap = HashMultimap.create();
for (GeneratedReferenceInfo referenceInfo : tableInfo.generatedColumns()) {
if (referenceInfo.referencedReferenceInfos().size() == 1 &&
tableInfo.partitionedByColumns().contains(referenceInfo)) {
multiMap.put(referenceInfo.referencedReferenceInfos().get(0), referenceInfo);
}
}
return multiMap;
}
示例10: setUp
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
waitForIdleState();
projectExplorer = (ProjectExplorer) showView(ProjectExplorer.VIEW_ID);
waitForUiThread();
assertNotNull("Cannot show Project Explorer.", projectExplorer);
commonViewer = projectExplorer.getCommonViewer();
assertFalse("Expected projects as top level elements in navigator.", broker.isWorkingSetTopLevel());
assertNull(
"Select working set drop down contribution was visible when projects are configured as top level elements.",
getWorkingSetDropDownContribution());
final Multimap<ProjectType, String> typeNamesMapping = HashMultimap.create();
typeNamesMapping.putAll(LIBRARY, LIBRARY_PROJECTS);
typeNamesMapping.putAll(TEST, TEST_PROJECTS);
for (final Entry<ProjectType, Collection<String>> entry : typeNamesMapping.asMap().entrySet()) {
for (final String projectName : entry.getValue()) {
createN4JSProject(projectName, entry.getKey());
}
}
// Actually close "Closed*" projects
closeProject("ClosedL2");
closeProject("ClosedT2");
// Wait for workbench to reflect project changes
waitForIdleState();
commonViewer.refresh();
// Disable auto-building, as there is no real code to build involved
ResourcesPlugin.getWorkspace().getDescription().setAutoBuilding(false);
}
示例11: MemberMatches
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
public MemberMatches() {
m_matches = HashBiMap.create();
m_matchedSourceEntries = HashMultimap.create();
m_unmatchedSourceEntries = HashMultimap.create();
m_unmatchedDestEntries = HashMultimap.create();
m_unmatchableSourceEntries = HashMultimap.create();
}
示例12: maakDienstbundelgroepDienstbundelMapping
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
private SetMultimap<Integer, DienstbundelGroep> maakDienstbundelgroepDienstbundelMapping(final List<DienstbundelGroep> alleDienstBundelgroepen) {
final SetMultimap<Integer, DienstbundelGroep> map = HashMultimap.create();
for (final DienstbundelGroep dienstbundelGroep : alleDienstBundelgroepen) {
map.put(dienstbundelGroep.getDienstbundel().getId(), dienstbundelGroep);
}
return map;
}
示例13: getAttributeModifiers
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot,
ItemStack stack) {
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER,
"Weapon modifier", (double) 8.5F + this.getAttackDamage(stack), 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(),
new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", (double) (-3.4F + ((getEfficiency(stack) / 2.7F) * 0.125F)), 0));
}
return multimap;
}
示例14: maakDienstMapping
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
private SetMultimap<Integer, Dienst> maakDienstMapping(final List<Dienst> alleDiensten) {
final SetMultimap<Integer, Dienst> map = HashMultimap.create();
for (final Dienst dienst : alleDiensten) {
map.put(dienst.getDienstbundel().getId(), dienst);
}
return map;
}
示例15: getItemAttributeModifiers
import com.google.common.collect.HashMultimap; //导入方法依赖的package包/类
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
{
return HashMultimap.<String, AttributeModifier>create();
}