Example usage for com.google.common.collect ImmutableBiMap copyOf

List of usage examples for com.google.common.collect ImmutableBiMap copyOf

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableBiMap copyOf.

Prototype

public static <K, V> ImmutableBiMap<K, V> copyOf(Iterable<? extends Entry<? extends K, ? extends V>> entries) 

Source Link

Usage

From source file:com.facebook.presto.sql.planner.DomainUtils.java

public static <T> Map<Symbol, T> columnHandleToSymbol(Map<ColumnHandle, T> columnMap,
        Map<Symbol, ColumnHandle> assignments) {
    Map<ColumnHandle, Symbol> inverseAssignments = ImmutableBiMap.copyOf(assignments).inverse();
    Preconditions.checkArgument(inverseAssignments.keySet().containsAll(columnMap.keySet()),
            "assignments does not contain all required column handles");
    ImmutableMap.Builder<Symbol, T> builder = ImmutableMap.builder();
    for (Map.Entry<ColumnHandle, T> entry : columnMap.entrySet()) {
        builder.put(inverseAssignments.get(entry.getKey()), entry.getValue());
    }//  w  w w.j  a  v a 2  s.  co m
    return builder.build();
}

From source file:org.opendaylight.yangtools.binding.data.codec.impl.EnumerationCodec.java

public EnumerationCodec(final Class<? extends Enum<?>> enumeration, final Map<String, Enum<?>> schema) {
    super(enumeration);
    yangValueToBinding = ImmutableBiMap.copyOf(schema);
}

From source file:net.derquinse.common.collect.ImmutableIndexedHierarchy.java

/**
 * Returns an immutable indexed hierarchy backed by a bimap and a hierarchy.
 * @param map Backing map.//from   w  w w .j ava2s. c  om
 * @param hierarchy Backing hierachy.
 */
public static <K, V> ImmutableIndexedHierarchy<K, V> of(BiMap<? extends K, ? extends V> map,
        Hierarchy<? extends K> hierarchy) {
    check(map, hierarchy);
    if (map.isEmpty()) {
        return of();
    }
    return new RegularImmutableIndexedHierarchy<K, V>(ImmutableBiMap.copyOf(map),
            ImmutableHierarchy.copyOf(hierarchy));
}

From source file:io.scigraph.owlapi.curies.CurieUtil.java

/***
 * @param curieMap A map from CURIE prefix to IRI prefix
 *//*w  w  w . j a  v  a  2 s. com*/
@Inject
public CurieUtil(@IndicatesCurieMapping Map<String, String> curieMap) {
    this.curieMap = ImmutableBiMap.copyOf(checkNotNull(curieMap));
}

From source file:edu.sdsc.scigraph.owlapi.curies.CurieUtil.java

/***
 * @param curieMap A map from CURIE prefix to IRI prefix
 *//*  w w w .j a va 2s.  c o  m*/
@Inject
public CurieUtil(@IndicatesCurieMapping Map<String, String> curieMap) {
    this.curieMap = ImmutableBiMap.copyOf(curieMap);
}

From source file:infrascructure.data.vocabulary.VocabularyImpl.java

/**
 *
 *//*from  www  . j a  va  2s. c om*/
public VocabularyImpl(Map<String, Integer> words, List<Word> wordCounts) {
    this.wordCounts = ImmutableList.copyOf(wordCounts);
    this.words = ImmutableBiMap.copyOf(words);
}

From source file:org.opendaylight.yangtools.yang.parser.stmt.rfc6020.StmtNamespaceContext.java

private StmtNamespaceContext(final StmtContext<?, ?, ?> ctx, final BiMap<String, String> URIToPrefixMap) {
    this.ctx = Preconditions.checkNotNull(ctx);
    this.URIToPrefixMap = ImmutableBiMap.copyOf(Preconditions.checkNotNull(URIToPrefixMap));
}

From source file:net.conquiris.schema.SchemaImpl.java

/**
 * Constructor.
 * @param map Schema items.
 */
SchemaImpl(Map<String, SchemaItem> map) {
    this.map = ImmutableBiMap.copyOf(map);
}

From source file:io.datakernel.serializer.GsonSubclassesAdapter.java

public GsonSubclassesAdapter(Map<String, Class<? extends T>> classTags,
        Map<String, InstanceCreator<T>> classCreators, String subclassField,
        Map<String, Class<? extends T>> subclassNames) {
    this.classTags = ImmutableBiMap.copyOf(classTags);
    this.classCreators = ImmutableMap.copyOf(classCreators);
    this.subclassField = subclassField;
    this.subclassNames = ImmutableBiMap.copyOf(subclassNames);
}

From source file:org.mule.module.xml.xpath.XPathNamespaceContext.java

XPathNamespaceContext(Map<String, String> prefixToNamespaceMap) {
    Map<String, String> namespaces = new HashMap<>();
    if (prefixToNamespaceMap != null) {
        namespaces.putAll(prefixToNamespaceMap);
    }/* w w  w.j  a  v a 2 s.  com*/

    loadDefaultNamespaces(namespaces);
    this.prefixToNamespaceMap = ImmutableBiMap.copyOf(namespaces);
}