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

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

Introduction

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

Prototype

public static <K, V> ImmutableMultimap<K, V> of() 

Source Link

Document

Returns an empty multimap.

Usage

From source file:org.spongepowered.common.registry.SpongeVillagerRegistry.java

@Override
public Multimap<Integer, TradeOfferListMutator> getTradeOfferLevelMap(Career career) {
    final Multimap<Integer, TradeOfferListMutator> multimap = this.careerGeneratorMap
            .get(checkNotNull(career, "Career cannot be null!"));
    if (multimap == null) {
        return ImmutableMultimap.of();
    } else {//from  w w w . jav  a 2  s  . c  o m
        return ImmutableMultimap.copyOf(multimap);
    }
}

From source file:org.apache.calcite.schema.impl.AbstractSchema.java

/**
 * Returns a multi-map of functions in this schema by name.
 * It is a multi-map because functions are overloaded; there may be more than
 * one function in a schema with a given name (as long as they have different
 * parameter lists).// w  w w. j a va  2 s.c o m
 *
 * <p>The implementations of {@link #getFunctionNames()}
 * and {@link Schema#getFunctions(String)} depend on this map.
 * The default implementation of this method returns the empty multi-map.
 * Override this method to change their behavior.</p>
 *
 * @return Multi-map of functions in this schema by name
 */
protected Multimap<String, Function> getFunctionMultimap() {
    return ImmutableMultimap.of();
}

From source file:net.conquiris.lucene.search.Hit.java

/**
 * Constructor.//from ww w .  j  a va  2s.  c  o  m
 */
private Hit(int docId, float score, Document document, @Nullable Multimap<String, String> fragments) {
    this.docId = docId;
    this.score = score;
    this.document = checkNotNull(document, "The document must be provided");
    if (fragments == null) {
        this.fragments = ImmutableMultimap.of();
    } else {
        this.fragments = ImmutableMultimap.copyOf(fragments);
    }
    ImmutableListMultimap.Builder<String, Fieldable> fieldsBuilder = ImmutableListMultimap.builder();
    ImmutableListMultimap.Builder<String, Number> numericBuilder = ImmutableListMultimap.builder();
    ImmutableListMultimap.Builder<String, Fieldable> binaryBuilder = ImmutableListMultimap.builder();
    for (Fieldable f : document.getFields()) {
        final String name = f.name();
        if (f.isBinary()) {
            binaryBuilder.put(name, f);
        } else {
            fieldsBuilder.put(name, f);
            if (f instanceof NumericField) {
                numericBuilder.put(name, ((NumericField) f).getNumericValue());
            }
        }
    }
    this.fields = fieldsBuilder.build();
    this.numeric = numericBuilder.build();
    this.binary = binaryBuilder.build();
}

From source file:com.facebook.buck.features.halide.HalideLibrary.java

@Override
public CxxPreprocessorInput getCxxPreprocessorInput(CxxPlatform cxxPlatform, ActionGraphBuilder graphBuilder) {
    if (!isPlatformSupported(cxxPlatform)) {
        return CxxPreprocessorInput.of();
    }//from   w  ww . j  a  v a 2  s.com
    return CxxPreprocessables.getCxxPreprocessorInput(getBuildTarget(), graphBuilder,
            /* hasHeaderSymlinkTree */ true, cxxPlatform, HeaderVisibility.PUBLIC,
            CxxPreprocessables.IncludeType.SYSTEM, ImmutableMultimap.of(), ImmutableList.of());
}

From source file:com.facebook.buck.halide.HalideLibrary.java

@Override
public CxxPreprocessorInput getCxxPreprocessorInput(CxxPlatform cxxPlatform, HeaderVisibility headerVisibility)
        throws NoSuchBuildTargetException {
    if (!isPlatformSupported(cxxPlatform)) {
        return CxxPreprocessorInput.EMPTY;
    }//from w w w .  j  a va  2  s. c  om
    switch (headerVisibility) {
    case PUBLIC:
        return CxxPreprocessables.getCxxPreprocessorInput(params, ruleResolver, /* hasHeaderSymlinkTree */ true,
                cxxPlatform, headerVisibility, CxxPreprocessables.IncludeType.SYSTEM, ImmutableMultimap.of(),
                ImmutableList.of());
    case PRIVATE:
        return CxxPreprocessorInput.EMPTY;
    }

    throw new RuntimeException("Invalid header visibility: " + headerVisibility);
}

From source file:org.apache.shindig.gadgets.spec.Feature.java

/**
 * Creates a new Feature from an xml node.
 *
 * @param feature The feature to create//w  ww.  ja  va  2  s .c om
 * @throws SpecParserException When the Require or Optional tag is not valid
 */
public Feature(Element feature) throws SpecParserException {
    this.required = feature.getNodeName().equals("Require");
    String name = XmlUtil.getAttribute(feature, "feature");
    if (name == null) {
        throw new SpecParserException((required ? "Require" : "Optional") + "@feature is required.");
    }
    this.name = name;
    NodeList children = feature.getElementsByTagName("Param");
    if (children.getLength() > 0) {
        ImmutableMultimap.Builder<String, String> params = ImmutableMultimap.builder();

        for (int i = 0, j = children.getLength(); i < j; ++i) {
            Element param = (Element) children.item(i);
            String paramName = XmlUtil.getAttribute(param, "name");
            if (paramName == null) {
                throw new SpecParserException("Param@name is required");
            }
            params.put(paramName, param.getTextContent());
        }
        this.params = params.build();
    } else {
        this.params = ImmutableMultimap.of();
    }
}

From source file:com.spectralogic.ds3client.helpers.strategy.channelstrategy.RandomAccessChannelStrategy.java

private ImmutableMultimap<BulkObject, Range> getRangesForABlob(final BulkObject blob) {
    if (Guard.isMapNullOrEmpty(rangesForBlobs)) {
        return ImmutableMultimap.of();
    }//from   w ww  . j  a va 2  s .  c  o  m

    final ImmutableMultimap<BulkObject, Range> rangesForABlob = rangesForBlobs.get(blob.getName());

    if (Guard.isMultiMapNullOrEmpty(rangesForABlob)) {
        return ImmutableMultimap.of();
    }

    return rangesForABlob;
}

From source file:com.google.caliper.EnvironmentGetter.java

private static Multimap<String, String> propertiesFromLinuxFile(String file) {
    try {/*from  w  w w  .  ja v  a 2  s  .  c  o  m*/
        Process process = Runtime.getRuntime().exec(new String[] { "/bin/cat", file });
        return propertiesFileToMultimap(new InputStreamReader(process.getInputStream(), "ISO-8859-1"));
    } catch (IOException e) {
        return ImmutableMultimap.of();
    }
}

From source file:com.google.devtools.build.lib.packages.AspectDefinition.java

/**
 * Returns the attribute -&gt; set of labels that are provided by aspects of attribute.
 *///from   w w  w.  ja  v a 2  s  . com
public static ImmutableMultimap<Attribute, Label> visitAspectsIfRequired(Target from, Attribute attribute,
        Target to, DependencyFilter dependencyFilter) {
    // Aspect can be declared only for Rules.
    if (!(from instanceof Rule) || !(to instanceof Rule)) {
        return ImmutableMultimap.of();
    }
    RuleClass ruleClass = ((Rule) to).getRuleClassObject();
    AdvertisedProviderSet providers = ruleClass.getAdvertisedProviders();
    return visitAspectsIfRequired((Rule) from, attribute, providers, dependencyFilter);
}

From source file:com.facebook.buck.cxx.CxxBinary.java

@Override
public CxxPreprocessorInput getCxxPreprocessorInput(CxxPlatform cxxPlatform, HeaderVisibility headerVisibility)
        throws NoSuchBuildTargetException {
    return CxxPreprocessables.getCxxPreprocessorInput(params.copyWithBuildTarget(platformlessTarget),
            ruleResolver, /* hasHeaderSymlinkTree */ true, cxxPlatform, headerVisibility,
            CxxPreprocessables.IncludeType.LOCAL, ImmutableMultimap.of(), frameworks);
}