Example usage for com.google.common.collect SetMultimap entries

List of usage examples for com.google.common.collect SetMultimap entries

Introduction

In this page you can find the example usage for com.google.common.collect SetMultimap entries.

Prototype

@Override
Set<Map.Entry<K, V>> entries();

Source Link

Document

Because a SetMultimap has unique values for a given key, this method returns a Set , instead of the java.util.Collection specified in the Multimap interface.

Usage

From source file:org.sonar.server.computation.measure.MeasureRepoEntry.java

public static Iterable<MeasureRepoEntry> toEntries(SetMultimap<String, Measure> data) {
    return FluentIterable.from(data.entries()).transform(toMeasureRepoEntry()).toList();
}

From source file:org.jetbrains.jet.lang.resolve.calls.smartcasts.DelegatingDataFlowInfo.java

private static boolean containsAll(SetMultimap<DataFlowValue, JetType> first,
        SetMultimap<DataFlowValue, JetType> second) {
    return first.entries().containsAll(second.entries());
}

From source file:uk.ac.ebi.atlas.search.baseline.BaselineExperimentAssayGroupSearchService.java

static ImmutableSet<IndexedAssayGroup> createSetOfIndexedAssayGroups(
        SetMultimap<String, String> assayGroupsPerExperiment) {
    ImmutableSet.Builder<IndexedAssayGroup> builder = ImmutableSet.builder();

    for (Map.Entry<String, String> entry : assayGroupsPerExperiment.entries()) {
        builder.add(new IndexedAssayGroup(entry.getKey(), entry.getValue()));
    }/*from   ww  w .java2s  .  co  m*/

    return builder.build();
}

From source file:org.jetbrains.kotlin.resolve.calls.smartcasts.DelegatingDataFlowInfo.java

private static boolean containsAll(SetMultimap<DataFlowValue, KotlinType> first,
        SetMultimap<DataFlowValue, KotlinType> second) {
    return first.entries().containsAll(second.entries());
}

From source file:org.apache.kylin.source.hive.HiveSourceTableLoader.java

public static Set<String> loadHiveTables(String[] hiveTables, KylinConfig config) throws IOException {

    SetMultimap<String, String> db2tables = LinkedHashMultimap.create();
    for (String fullTableName : hiveTables) {
        String[] parts = HadoopUtil.parseHiveTableName(fullTableName);
        db2tables.put(parts[0], parts[1]);
    }//  w  w  w .  ja  v  a2s.  c om

    IHiveClient hiveClient = HiveClientFactory.getHiveClient();
    SchemaChecker checker = new SchemaChecker(hiveClient, MetadataManager.getInstance(config),
            CubeManager.getInstance(config));
    for (Map.Entry<String, String> entry : db2tables.entries()) {
        SchemaChecker.CheckResult result = checker.allowReload(entry.getKey(), entry.getValue());
        result.raiseExceptionWhenInvalid();
    }

    // extract from hive
    Set<String> loadedTables = Sets.newHashSet();
    for (String database : db2tables.keySet()) {
        List<String> loaded = extractHiveTables(database, db2tables.get(database), hiveClient);
        loadedTables.addAll(loaded);
    }

    return loadedTables;
}

From source file:eu.esdihumboldt.hale.ui.style.StyleHelper.java

/**
 * Returns a default style for the given type.
 * /*from  ww w  .j a v a  2  s .  c  o  m*/
 * @param dataSetTypes type definitions associated to their data set
 * @return the style
 */
public static Style getRandomStyles(SetMultimap<DataSet, TypeDefinition> dataSetTypes) {
    int defWidth = StylePreferences.getDefaultWidth();

    Style style = styleFactory.createStyle();

    for (Entry<DataSet, TypeDefinition> entry : dataSetTypes.entries()) {
        DataSet dataSet = entry.getKey();
        TypeDefinition typeDef = entry.getValue();

        FeatureTypeStyle fts;

        // TODO based on default geometry?
        // polygon is always OK as it contains stroke and fill

        // Color color = generateRandomColor(Color.WHITE);
        float saturation;
        float brightness;
        switch (dataSet) {
        case TRANSFORMED:
            saturation = 0.8f;
            brightness = 0.6f;
            break;
        case SOURCE:
        default:
            saturation = 0.75f;
            brightness = 0.8f;
            break;
        }
        Color color = generateRandomColor(saturation, brightness);
        fts = createPolygonStyle(color, defWidth);

        fts.featureTypeNames().add(new NameImpl(getFeatureTypeName(typeDef)));

        style.featureTypeStyles().add(fts);
    }

    return style;
}

From source file:com.publictransitanalytics.scoregenerator.environment.StoredGrid.java

private static void storeGridPointAssocations(final String gridId,
        final SetMultimap<GridPoint, Sector> gridPointSectorMap,
        final Store<GridPointAssociationKey, GridPointAssociation> store) throws InterruptedException {
    for (final Map.Entry<GridPoint, Sector> entry : gridPointSectorMap.entries()) {
        final GridPoint gridPoint = entry.getKey();
        final Sector sector = entry.getValue();
        final GridPointAssociationKey key = new GridPointAssociationKey(gridId, gridPoint, sector);
        final GridPointAssociation value = new GridPointAssociation(gridPoint.getIdentifier(),
                gridPoint.getLocation().toString(), sector.getIdentifier());
        try {/*from   w w  w . ja v a 2 s . co m*/
            store.put(key, value);
        } catch (final BitvantageStoreException e) {
            throw new ScoreGeneratorFatalException(e);
        }
    }
}

From source file:org.eclipse.sw360.commonIO.ConvertRecord.java

@NotNull
public static <T, U> List<List<String>> serialize(SetMultimap<T, U> aToB, List<String> headers) {
    final List<List<String>> mapEntryList = new ArrayList<>(aToB.size() + 1);

    mapEntryList.add(headers);/* www. j  a v  a2s.  c o m*/

    for (Map.Entry<T, U> mapEntry : aToB.entries()) {
        final ArrayList<String> entry = new ArrayList<>(2);
        entry.add(mapEntry.getKey().toString());
        entry.add(mapEntry.getValue().toString());
        mapEntryList.add(entry);
    }
    return mapEntryList;
}

From source file:tiger.Utils.java

public static <K, V> SetMultimap<V, K> reverseSetMultimap(SetMultimap<K, V> map) {
    SetMultimap<V, K> result = HashMultimap.create();
    for (Map.Entry<K, V> entry : map.entries()) {
        result.put(entry.getValue(), entry.getKey());
    }//from   ww w  . j  a va2  s  .  c  o m
    return result;
}

From source file:dagger.android.processor.AndroidMapKeyValidator.java

@Override
public Set<Element> process(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation) {
    elementsByAnnotation.entries()
            .forEach((entry) -> validateMethod(entry.getKey(), MoreElements.asExecutable(entry.getValue())));
    return ImmutableSet.of();
}