Example usage for com.google.common.collect Maps immutableEntry

List of usage examples for com.google.common.collect Maps immutableEntry

Introduction

In this page you can find the example usage for com.google.common.collect Maps immutableEntry.

Prototype

@GwtCompatible(serializable = true)
public static <K, V> Entry<K, V> immutableEntry(@Nullable K key, @Nullable V value) 

Source Link

Document

Returns an immutable map entry with the specified key and value.

Usage

From source file:com.nesscomputing.migratory.mojo.database.util.MojoLocator.java

@Override
protected Map.Entry<URI, String> getBaseInformation(final String personalityName, final String databaseType) {
    final StringBuilder location = new StringBuilder(manifestUrl);
    if (!manifestUrl.endsWith("/")) {
        location.append("/");
    }/*from  w  w w  .ja va  2s.  c  om*/
    location.append(personalityName);

    return Maps.immutableEntry(URI.create(location.toString()), personalityName + ".*");
}

From source file:org.zalando.logbook.QueryParameters.java

private static Map.Entry<String, String> encodeEntry(final Map.Entry<String, String> entry) {
    return Maps.immutableEntry(urlEncodeUTF8(entry.getKey()), urlEncodeUTF8(entry.getValue()));
}

From source file:me.lucko.luckperms.common.utils.PatternCache.java

public static String buildDelimitedMatcher(String delim, String esc) {
    return DELIMITER_CACHE.get(Maps.immutableEntry(delim, esc));
}

From source file:com.palantir.common.collect.MapEntries.java

public static <L, F, T> Function<Entry<L, F>, Entry<L, T>> applyValue(final Function<F, T> f) {
    return new Function<Map.Entry<L, F>, Map.Entry<L, T>>() {
        @Override/*from w  ww  .jav a  2  s  .c  om*/
        public Entry<L, T> apply(Entry<L, F> from) {
            return Maps.immutableEntry(from.getKey(), f.apply(from.getValue()));
        }
    };
}

From source file:ninja.leaping.permissionsex.extrabackends.groupmanager.GroupManagerContextInheritance.java

public GroupManagerContextInheritance(ConfigurationNode mirrorsNode) {
    worlds = new HashMap<>();
    for (Map.Entry<Object, ? extends ConfigurationNode> entry : mirrorsNode.getChildrenMap().entrySet()) {
        final Map.Entry<String, String> worldContext = Maps.immutableEntry("world", entry.getKey().toString());
        for (Object child : entry.getValue().getChildrenMap().keySet()) {
            List<Map.Entry<String, String>> world = worlds.get(child.toString());
            if (world == null) {
                world = new ArrayList<>();
                worlds.put(child.toString(), world);
            }//from   w  w  w. j  av  a  2s . c  o m
            world.add(worldContext);
        }
    }
}

From source file:cosmos.sql.impl.functions.IndexTransform.java

@Override
public Entry<String, RelDataType> apply(Index input) {

    return Maps.immutableEntry(input.column().toString(), javaFactory.createSqlType(SqlTypeName.VARCHAR));
}

From source file:dagger.internal.codegen.DaggerStreams.java

/**
 * Returns a {@link Collector} that accumulates elements into an {@code ImmutableMap} whose keys
 * and values are the result of applying the provided mapping functions to the input elements.
 * Entries appear in the result {@code ImmutableMap} in encounter order.
 *//*from  w  w  w .  ja v  a  2s . co  m*/
// TODO(b/68008628): Use ImmutableMap.toImmutableMap().
public static <T, K, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(Function<? super T, K> keyMapper,
        Function<? super T, V> valueMapper) {
    return Collectors.mapping(value -> Maps.immutableEntry(keyMapper.apply(value), valueMapper.apply(value)),
            Collector.of(ImmutableMap::builder,
                    (ImmutableMap.Builder<K, V> builder, Map.Entry<K, V> entry) -> builder.put(entry),
                    (left, right) -> left.putAll(right.build()), ImmutableMap.Builder::build));
}

From source file:com.nesscomputing.migratory.locator.MetadataMigrationLocator.java

@Override
protected Map.Entry<URI, String> getBaseInformation(final String personalityName, final String databaseType) {
    // Knows only about the basic migrations.
    if (MetadataManager.METADATA_MIGRATION_NAME.equals(personalityName)) {
        return Maps.immutableEntry(URI.create(METADATA_LOCATION + databaseType), METADATA_PATTERN);
    }/*w ww. ja va2  s  .  com*/
    return null;
}

From source file:org.renyan.leveldb.impl.WriteBatchImpl.java

@Override
public WriteBatchImpl put(byte[] key, byte[] value) {
    Preconditions.checkNotNull(key, "key is null");
    Preconditions.checkNotNull(value, "value is null");
    batch.add(Maps.immutableEntry(Slices.wrappedBuffer(key), Slices.wrappedBuffer(value)));
    approximateSize += 12 + key.length + value.length;
    return this;
}

From source file:org.opendaylight.controller.config.yangjmxgenerator.plugin.java.GeneratedObject.java

public Optional<Entry<FullyQualifiedName, File>> persist(File srcDirectory, boolean overwrite)
        throws IOException {
    File dstFile = fqn.toFile(srcDirectory);
    if (overwrite || !dstFile.exists()) {
        Files.createParentDirs(dstFile);
        Files.touch(dstFile);/*from  w  w  w.ja v a2s. c  o m*/
        Files.write(content, dstFile, StandardCharsets.UTF_8);
        return Optional.of(Maps.immutableEntry(fqn, dstFile));
    } else {
        return Optional.absent();
    }
}