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

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

Introduction

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

Prototype

@Override
    public ImmutableSet<V> values() 

Source Link

Usage

From source file:com.google.errorprone.scanner.ScannerSupplier.java

/**
 * Returns a {@link ScannerSupplier} built from a list of {@link BugCheckerInfo}s.
 *//*from www.j  av  a2  s .c  om*/
public static ScannerSupplier fromBugCheckerInfos(Iterable<BugCheckerInfo> checkers) {
    ImmutableBiMap.Builder<String, BugCheckerInfo> builder = ImmutableBiMap.builder();
    for (BugCheckerInfo checker : checkers) {
        builder.put(checker.canonicalName(), checker);
    }
    ImmutableBiMap<String, BugCheckerInfo> allChecks = builder.build();
    return new ScannerSupplierImpl(allChecks, defaultSeverities(allChecks.values()), ImmutableSet.<String>of());
}

From source file:cz.cuni.mff.ms.brodecva.botnicek.ide.design.system.model.NormalizedNamingAuthority.java

@Override
public void tryReplace(final Map<? extends String, ? extends String> oldToNew) {
    Preconditions.checkNotNull(oldToNew);

    final ImmutableBiMap<String, String> copy = ImmutableBiMap.copyOf(oldToNew);

    for (final Map.Entry<String, String> replacementPair : copy.entrySet()) {
        final String oldName = replacementPair.getKey();
        final String newName = replacementPair.getValue();

        Preconditions.checkArgument(isUsed(oldName), ExceptionLocalizer.print("NameNotUsed", oldName));
        Preconditions.checkArgument(oldName.equals(newName) || isUsable(newName),
                ExceptionLocalizer.print("NameNotUsable", newName));
    }/*from ww w . j  a v  a 2 s.c om*/

    final Set<String> oldNames = copy.keySet();
    final Set<String> newNames = copy.values();
    for (final String oldName : oldNames) {
        this.used.remove(oldName);
    }

    for (final String newName : newNames) {
        this.used.add(newName);
    }
}