Example usage for com.google.common.collect ImmutableListMultimap of

List of usage examples for com.google.common.collect ImmutableListMultimap of

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableListMultimap of.

Prototype


@SuppressWarnings("unchecked")
public static <K, V> ImmutableListMultimap<K, V> of() 

Source Link

Document

Returns the empty multimap.

Usage

From source file:org.graylog2.indexer.results.HighlightParser.java

static Multimap<String, Range<Integer>> extractHighlightRanges(Map<String, List<String>> highlight) {
    if (highlight == null || highlight.isEmpty()) {
        return ImmutableListMultimap.of();
    }//  w w w  . j  a va 2 s.  c o  m
    final ImmutableListMultimap.Builder<String, Range<Integer>> builder = ImmutableListMultimap.builder();
    highlight.forEach((key, value) -> extractRange(value).forEach(range -> builder.put(key, range)));
    return builder.build();
}

From source file:net.oneandone.maven.rules.common.RuleHelper.java

public static ImmutableListMultimap<String, Dependency> getManagedDependenciesAsMap(MavenProject project) {
    if (project.getDependencyManagement() != null) {
        return Multimaps.index(project.getDependencyManagement().getDependencies(),
                new Function<Dependency, String>() {
                    public String apply(Dependency from) {
                        if (from != null) {
                            return from.getGroupId() + ":" + from.getArtifactId();
                        }/*from w  ww .jav a2  s  .c o  m*/

                        return null;
                    }
                });

    }
    return ImmutableListMultimap.of();
}

From source file:org.javersion.store.jdbc.FetchResults.java

public FetchResults() {
    versionsByDocId = ImmutableListMultimap.of();
    latestRevision = null;
}

From source file:de.metas.ui.web.quickinput.QuickInputDescriptorFactoryService.java

private static ImmutableListMultimap<IQuickInputDescriptorFactory.MatchingKey, IQuickInputDescriptorFactory> createFactoriesFromContext(
        final List<IQuickInputDescriptorFactory> factoriesList) {
    if (factoriesList == null || factoriesList.isEmpty()) {
        return ImmutableListMultimap.of();
    }// ww w.  ja v  a  2  s . c  o m

    final ImmutableListMultimap.Builder<IQuickInputDescriptorFactory.MatchingKey, IQuickInputDescriptorFactory> factoriesMap = ImmutableListMultimap
            .builder();
    for (final IQuickInputDescriptorFactory factory : factoriesList) {
        final Set<IQuickInputDescriptorFactory.MatchingKey> matchingKeys = factory.getMatchingKeys();
        if (matchingKeys == null || matchingKeys.isEmpty()) {
            logger.warn("Ignoring {} because it provides no matching keys", factory);
            break;
        }

        for (final IQuickInputDescriptorFactory.MatchingKey matchingKey : matchingKeys) {
            factoriesMap.put(matchingKey, factory);
        }
    }

    return factoriesMap.build();
}

From source file:com.isotrol.impe3.core.impl.AbstractMultiStringParameters.java

final ListMultimap<CaseIgnoringString, String> submap(Set<String> included) {
    if (included == null || included.isEmpty()) {
        return ImmutableListMultimap.of();
    }//w w w  .  ja  va 2s .  c  o  m
    final ImmutableListMultimap.Builder<CaseIgnoringString, String> builder = ImmutableListMultimap.builder();
    for (Map.Entry<CaseIgnoringString, Collection<String>> entry : map().asMap().entrySet()) {
        if (included.contains(entry.getKey())) {
            builder.putAll(entry.getKey(), entry.getValue());
        }
    }
    return builder.build();
}

From source file:com.google.gerrit.server.notedb.ChangeNotesState.java

static ChangeNotesState empty(Change change) {
    return new AutoValue_ChangeNotesState(null, change.getId(), null, ImmutableSet.of(), ImmutableSet.of(),
            ImmutableList.of(), ImmutableList.of(), ReviewerSet.empty(), ReviewerByEmailSet.empty(),
            ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of(),
            ImmutableListMultimap.of(), ImmutableListMultimap.of(), null, null);
}

From source file:org.caleydo.data.importer.tcga.model.ClinicalMapping.java

/**
 * @param string//  ww w. jav a  2s.c o m
 * @return
 */
private static ListMultimap<String, CategoryProperty<String>> parseProperties(String fileName) {
    try (InputStreamReader r = new InputStreamReader(
            ClinicalMapping.class.getResourceAsStream("/resources/" + fileName))) {
        List<String> lines = CharStreams.readLines(r);
        lines.remove(0);
        ListMultimap<String, CategoryProperty<String>> result = ArrayListMultimap.create();
        for (String line : lines) {
            String[] ls = line.split("\t");
            String key = ls[0];
            String name = ls[1];
            String label = ls.length > 2 ? ls[2] : name;
            Color color = ls.length > 3 ? new Color(ls[3]) : null;
            result.put(key, new CategoryProperty<String>(name, label, color));
        }
        return result;
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ImmutableListMultimap.of();
}

From source file:org.ambraproject.wombat.freemarker.TemplateModelUtil.java

static ImmutableListMultimap<String, TemplateModel> getAsMultimap(TemplateModel value)
        throws TemplateModelException {
    if (value == null)
        return ImmutableListMultimap.of();
    if (value instanceof TemplateHashModelEx) {
        TemplateHashModelEx ftlHash = (TemplateHashModelEx) value;
        ImmutableListMultimap.Builder<String, TemplateModel> builder = ImmutableListMultimap.builder();
        for (TemplateModelIterator iterator = ftlHash.keys().iterator(); iterator.hasNext();) {
            String key = iterator.next().toString();
            TemplateModel model = ftlHash.get(key);
            if (model instanceof TemplateSequenceModel) {
                TemplateSequenceModel sequenceModel = (TemplateSequenceModel) model;
                int size = sequenceModel.size();
                for (int i = 0; i < size; i++) {
                    builder.put(key, sequenceModel.get(i));
                }/*from www.  jav  a  2 s .c  o  m*/
            } else {
                builder.put(key, model);
            }
        }
        return builder.build();
    }
    throw new TemplateModelException("Hash type expected");
}

From source file:de.adrodoc55.minecraft.mpl.compilation.CompilationFailedException.java

public CompilationFailedException(String message, NotEnoughSpaceException ex) {
    super(message, ex);
    exceptions = ImmutableListMultimap.of();
}

From source file:eu.trentorise.opendata.commons.Dict.java

private Dict() {
    strings = ImmutableListMultimap.of();
}