List of usage examples for com.google.common.collect ArrayListMultimap create
public static <K, V> ArrayListMultimap<K, V> create()
From source file:org.onosproject.cli.net.LabelReleaseCommand.java
@Override protected void execute() { LabelResourceService lrs = get(LabelResourceService.class); Multimap<DeviceId, LabelResource> map = ArrayListMultimap.create(); String[] labelIds = releaseLabelIds.split(","); DefaultLabelResource resource = null; for (int i = 0; i < labelIds.length; i++) { resource = new DefaultLabelResource(DeviceId.deviceId(deviceId), LabelResourceId.labelResourceId(Long.parseLong(labelIds[i]))); map.put(DeviceId.deviceId(deviceId), resource); }/*from www . ja va 2s . c o m*/ lrs.releaseToDevicePool(map); }
From source file:eu.esdihumboldt.hale.io.wfs.ui.types.FeatureTypeTreeContentProvider.java
@Override public Object[] getElements(Object inputElement) { if (inputElement == null) { nameSpaces = null;/*from ww w . j a v a 2s .c om*/ return new Object[0]; } @SuppressWarnings("unchecked") Collection<? extends QName> types = (Collection<? extends QName>) inputElement; nameSpaces = ArrayListMultimap.create(); for (QName type : types) { String ns = type.getNamespaceURI(); nameSpaces.put(ns, type); } return nameSpaces.keySet().toArray(); }
From source file:com.pronoiahealth.olhie.client.shared.events.local.SyncMenuWithViewEvent.java
public void addToMap(String key, Object value) { if (state == null) { state = ArrayListMultimap.create(); } state.put(key, value); }
From source file:no.ssb.vtl.script.operations.FoldOperation.java
/** * Check that all of the given columns are of the same type * * @return the type of all the columns.// w ww. j a v a2s. com * @throws IllegalArgumentException if columns are not of the same type. */ private static Class<?> checkColumnType(DataStructure structure, ImmutableSet<String> columns) { ListMultimap<Class<?>, String> classes = ArrayListMultimap.create(); for (String element : columns) { classes.put(structure.get(element).getType(), element); } checkArgument(classes.asMap().size() == 1, "all element(s) [%s] are not of the same type [%s]", columns, classes); return classes.keys().iterator().next(); }
From source file:it.sayservice.platform.smartplanner.otp.schedule.TransitTimes.java
public void buildStopIds() { BucketSet mergedBs = new BucketSet(); Multimap<String, TripTimes> map = ArrayListMultimap.create(); for (TripTimes tt : times) { map.put(tt.getRecurrence(), tt); }/*from w w w . j a va 2 s . c om*/ List<BucketSet> bss = new ArrayList<BucketSet>(); BucketSet bs; for (String key : map.keySet()) { bs = new BucketSet(); List<TripTimes> ttl = (List<TripTimes>) map.get(key); Collections.sort(ttl, new Comparator<TripTimes>() { @Override public int compare(TripTimes o1, TripTimes o2) { return o2.getTripTimes().size() - o1.getTripTimes().size(); } }); for (TripTimes tt : ttl) { List<Bucket> buckets = new ArrayList<Bucket>(); for (TripTimeEntry sch : tt.getTripTimes()) { Bucket b = sch.toBucket(); buckets.add(b); } bs.merge(buckets); } bss.add(bs); } for (BucketSet bs0 : bss) { mergedBs.merge(bs0.getBuckets()); } stopIds = mergedBs.getIds(); }
From source file:pt.org.aguiaj.common.widgets.FieldContainer.java
public FieldContainer(Composite parent, int style) { super(parent, style); fieldTable = ArrayListMultimap.create(); arrayPositionTable = new LinkedHashMap<Integer, ArrayPosition>(); isDirty = true;// w w w . j ava2s.c om }
From source file:org.jfrog.build.extractor.clientConfiguration.ArtifactSpecs.java
/** * Iterate over all the specs and if matches add the properties * * @param spec//w w w . j a v a 2s .c o m * @return */ public Multimap<String, CharSequence> getProperties(ArtifactSpec spec) { Multimap<String, CharSequence> props = ArrayListMultimap.create(); for (ArtifactSpec matcherSpec : this) { if (matcherSpec.matches(spec)) { Map<String, CharSequence> matcherSpecProperties = matcherSpec.getProperties(); for (Map.Entry<String, CharSequence> entry : matcherSpecProperties.entrySet()) { props.put(entry.getKey(), entry.getValue()); } } } return props; }
From source file:io.mapzone.arena.analytics.graph.edgefunctions.CompareColumnsWithDirectEdgeFunction.java
@Override public int generateEdges(final MdToolkit tk, final IProgressMonitor monitor, final Map<String, Node> nodes, final Graph graph) throws Exception { final ArrayListMultimap<Object, Node> edgesByKeyProperty = ArrayListMultimap.create(); // iterate on features int featureCount = 0; for (Node sourceNode : nodes.values()) { Feature sourceFeature = sourceNode.feature(); featureCount++;//from w w w .j a v a2s. c o m Object key = ((SimpleFeature) sourceFeature).getAttribute(selectedCompareProperty.getName()); // compare only if a value is set if (key != null && !"".equals(key.toString().trim())) { edgesByKeyProperty.put(key, sourceNode); } } Collection<Edge> edges = transform(edgesByKeyProperty); for (Edge edge : edges) { graph.addOrUpdateEdge(edge); } return edges.size(); }
From source file:eu.esdihumboldt.cst.internal.TransformationTreePool.java
/** * Create a transformation tree pool./*from ww w . jav a 2 s . com*/ * * @param alignment the associated alignment * @param matcher the context matcher to apply to a created tree */ public TransformationTreePool(Alignment alignment, ContextMatcher matcher) { this.alignment = alignment; this.matcher = matcher; trees = ArrayListMultimap.create(); }
From source file:forestry.apiculture.flowers.FlowerRegistry.java
public FlowerRegistry() { this.registeredFlowers = ArrayListMultimap.create(); this.growthRules = ArrayListMultimap.create(); this.chances = new HashMap<String, TreeMap<Double, IFlower>>(); this.hasDeprecatedFlowersImported = false; registerVanillaFlowers();/*from w ww .ja v a2 s. c o m*/ registerVanillaGrowthRules(); }