@Generates private static <K, V> HashMultimap<K, V> generateHashMultimap(K key, V value) { HashMultimap<K, V> multimap = HashMultimap.create(); multimap.put(key, value); return multimap; }
void putIfWorkExists(Operator<?> opToAdd, Operator<?> existingOp) { List<Operator<?>> c = ImmutableList.copyOf(operatorToWorkOperators.get(existingOp)); if (!c.isEmpty()) { for (Operator<?> op : c) { operatorToWorkOperators.get(op).add(opToAdd); } operatorToWorkOperators.putAll(opToAdd, c); operatorToWorkOperators.put(opToAdd, opToAdd); } }
public Multimap<String, Object> getDocument(final String txt, final long time, final double weight, final Geoshape geo, List<String> phoneList, Set<String> phoneSet, Instant date) { HashMultimap<String, Object> values = HashMultimap.create(); values.put(TEXT, txt); values.put(NAME, txt); values.put(TIME, time); values.put(WEIGHT, weight); values.put(LOCATION, geo); values.put(DATE, date); if(indexFeatures.supportsCardinality(Cardinality.LIST)) { for (String phone : phoneList) { values.put(PHONE_LIST, phone); } } if(indexFeatures.supportsCardinality(Cardinality.SET)) { for (String phone : phoneSet) { values.put(PHONE_SET, phone); } } return values; }
@Override public Void visitType(TypeElement parent, TypeElement type) { nextRound.put(parent.getSimpleName() + "." + type.getSimpleName(), type); importMap.put(type, parent); return null; }
public Multimap<String, Object> getDocument(final String txt, final long time, final double weight, final Geoshape location, final Geoshape boundary, List<String> phoneList, Set<String> phoneSet, Instant date) { final HashMultimap<String, Object> values = HashMultimap.create(); values.put(TEXT, txt); values.put(NAME, txt); values.put(TIME, time); values.put(WEIGHT, weight); values.put(LOCATION, location); values.put(BOUNDARY, boundary); values.put(DATE, date); if(indexFeatures.supportsCardinality(Cardinality.LIST)) { for (final String phone : phoneList) { values.put(PHONE_LIST, phone); } } if(indexFeatures.supportsCardinality(Cardinality.SET)) { for (final String phone : phoneSet) { values.put(PHONE_SET, phone); } } return values; }
@Override public synchronized void add(TitanVertexProperty property) { map.put(property.value(),property); }
@Override public void add(TitanVertexProperty property) { map.put(property.value(),property); }
@Override public synchronized void add(JanusGraphVertexProperty property) { map.put(property.value(),property); }
@Override public void add(JanusGraphVertexProperty property) { map.put(property.value(),property); }
public void testCreateFromMultimap() { HashMultimap<String, Integer> multimap = HashMultimap.create(); multimap.put("foo", 1); multimap.put("bar", 2); multimap.put("foo", 3); HashMultimap<String, Integer> copy = HashMultimap.create(multimap); assertEquals(multimap, copy); assertEquals(2, copy.expectedValuesPerKey); }
public T addPermission(OrganizationPermission permission, String organizationUuid) { permissionsByOrganizationUuid.put(organizationUuid, permission); return clazz.cast(this); }
private void registerType(TypeElement type) { if (type != null && !importMap.containsKey(type)) { typeMap.put(type.getSimpleName().toString(), type); importMap.put(type, type); for (TypeParameterElement typeParam : type.getTypeParameters()) { for (TypeMirror bound : typeParam.getBounds()) { // FIXME: get rid of cast using a visitor TypeElement boundElement = TYPE_ELEMENT_VISITOR.visit(helpers.asElement(bound)); registerType(boundElement); } } } }
public void testCopyOfNullKey() { HashMultimap<String, Integer> input = HashMultimap.create(); input.put(null, 1); try { ImmutableSetMultimap.copyOf(input); fail(); } catch (NullPointerException expected) { } }
private void refreshReadonlyBrokerGroupSettings() { final HashMultimap<String, String> map = HashMultimap.create(); final List<ReadonlyBrokerGroupSetting> settings = readonlyBrokerGroupSettingStore.allReadonlyBrokerGroupSettings(); for (final ReadonlyBrokerGroupSetting setting : settings) { map.put(setting.getBrokerGroup(), setting.getSubject()); } readonlyBrokerGroupSettings = map; }
public T addProjectPermission(String permission, ComponentDto... components) { Arrays.stream(components).forEach(component -> { checkArgument( component.isPrivate() || !PUBLIC_PERMISSIONS.contains(permission), "public component %s can't be granted public permission %s", component.uuid(), permission); }); registerComponents(components); this.projectPermissions.add(permission); Arrays.stream(components) .forEach(component -> this.projectUuidByPermission.put(permission, component.projectUuid())); return clazz.cast(this); }
/** * Use this method to register public root component and non root components the UserSession must be aware of. * (ie. this method can be used to emulate the content of the DB) */ public T registerComponents(ComponentDto... components) { Arrays.stream(components) .forEach(component -> { if (component.projectUuid().equals(component.uuid()) && !component.isPrivate()) { this.projectUuidByPermission.put(UserRole.USER, component.uuid()); this.projectUuidByPermission.put(UserRole.CODEVIEWER, component.uuid()); this.projectPermissions.add(UserRole.USER); this.projectPermissions.add(UserRole.CODEVIEWER); } this.projectUuidByComponentUuid.put(component.uuid(), component.projectUuid()); }); return clazz.cast(this); }
.map(currentPipelines::get) .filter(Objects::nonNull) .forEach(pipeline -> connections.put(streamConnection.streamId(), pipeline));