本文整理汇总了Java中com.google.common.collect.ImmutableMultimap.Builder.put方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.put方法的具体用法?Java Builder.put怎么用?Java Builder.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableMultimap.Builder
的用法示例。
在下文中一共展示了Builder.put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerNotificationListener
import com.google.common.collect.ImmutableMultimap.Builder; //导入方法依赖的package包/类
@Override
public synchronized <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener, final Collection<SchemaPath> types) {
final ListenerRegistration<T> reg = new AbstractListenerRegistration<T>(listener) {
@Override
protected void removeRegistration() {
final ListenerRegistration<T> me = this;
synchronized (DOMNotificationRouter.this) {
replaceListeners(ImmutableMultimap.copyOf(Multimaps.filterValues(listeners, input -> input != me)));
}
}
};
if (!types.isEmpty()) {
final Builder<SchemaPath, ListenerRegistration<? extends DOMNotificationListener>> b = ImmutableMultimap.builder();
b.putAll(listeners);
for (final SchemaPath t : types) {
b.put(t, reg);
}
replaceListeners(b.build());
}
return reg;
}
示例2: BratRelation
import com.google.common.collect.ImmutableMultimap.Builder; //导入方法依赖的package包/类
public BratRelation(BratRelationType type, BratEntity arg1, BratEntity arg2) {
super(type, ImmutableMultimap.<String, BratEntity>of());
if (!checkArgVal(arg1) || !checkArgVal(arg2)) {
throw new IllegalArgumentException(String.format(
"Relation %s arguments: %s, %s", type, arg1, arg2));
}
Builder<String, BratEntity> b = ImmutableMultimap.builder();
b.put(type.getArg1Name(), arg1);
b.put(type.getArg2Name(), arg2);
setRoleAnnotations(b.build());
}
示例3: getActionContexts
import com.google.common.collect.ImmutableMultimap.Builder; //导入方法依赖的package包/类
@Override
public Multimap<Class<? extends ActionContext>, String> getActionContexts() {
Builder<Class<? extends ActionContext>, String> contexts = ImmutableMultimap.builder();
contexts.put(SpawnActionContext.class, "standalone");
contexts.put(SpawnActionContext.class, "worker");
return contexts.build();
}
示例4: setAllInstitutions
import com.google.common.collect.ImmutableMultimap.Builder; //导入方法依赖的package包/类
private synchronized void setAllInstitutions(Map<Long, InstitutionStatus> map)
{
allInstitutions = ImmutableMap.copyOf(map);
Multimap<Long, Institution> newlyAvailable = ArrayListMultimap.create();
Multimap<Long, Institution> newlyUnavailable = ArrayListMultimap.create(availableInstitutions);
Builder<Long, Institution> availableBuilder = ImmutableMultimap.builder();
ImmutableMap.Builder<Long, Long> schemaBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Long, Institution> instBuilder = ImmutableMap.builder();
for( Entry<Long, InstitutionStatus> entry : allInstitutions.entrySet() )
{
InstitutionStatus instStatus = entry.getValue();
Institution institution = instStatus.getInstitution();
Long schemaId = instStatus.getSchemaId();
if( instStatus.isValid() && institution.isEnabled() )
{
availableBuilder.put(schemaId, institution);
if( !newlyUnavailable.remove(schemaId, institution) )
{
newlyAvailable.put(schemaId, institution);
}
}
long uniqueId = institution.getUniqueId();
schemaBuilder.put(uniqueId, schemaId);
instBuilder.put(uniqueId, institution);
}
availableInstitutions = availableBuilder.build();
schemaMap = schemaBuilder.build();
instMap = instBuilder.build();
if( !newlyAvailable.isEmpty() )
{
eventService.publishApplicationEvent(new InstitutionEvent(InstitutionEventType.AVAILABLE, newlyAvailable));
}
if( !newlyUnavailable.isEmpty() )
{
eventService
.publishApplicationEvent(new InstitutionEvent(InstitutionEventType.UNAVAILABLE, newlyUnavailable));
}
}
示例5: PackageComparator
import com.google.common.collect.ImmutableMultimap.Builder; //导入方法依赖的package包/类
public PackageComparator(final SortedSetMultimap<String, ModuleDescriptor> resolvedModuleDependencies) {
this.resolvedModuleDependencies = Preconditions.checkNotNull(resolvedModuleDependencies);
final Set<Entry<String,ModuleDescriptor>> entries = resolvedModuleDependencies.entries();
final Builder<String, ModuleDescriptor> builder = ImmutableMultimap.builder();
for (final Entry<String, ModuleDescriptor> entry : entries) {
final String javaPackageName = entry.getValue().getJavaPackageName();
builder.put(javaPackageName, entry.getValue());
}
this.modulesByPackageName = builder.build();
}