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.infinities.keystone4j.policy.reducer.MakeOrExprReducer.java

@Override
public Entry<String, BaseCheck> getEntry(List<Entry<String, BaseCheck>> entry) {
    List<BaseCheck> checks = Lists.newArrayList();
    checks.add(entry.get(0).getValue());
    checks.add(entry.get(2).getValue());
    BaseCheck orCheck = new OrCheck(checks);
    return Maps.immutableEntry("or_expr", orCheck);
}

From source file:com.infinities.keystone4j.policy.reducer.MakeAndExprReducer.java

@Override
public Entry<String, BaseCheck> getEntry(List<Entry<String, BaseCheck>> entry) {
    List<BaseCheck> checks = Lists.newArrayList();
    checks.add(entry.get(0).getValue());
    checks.add(entry.get(2).getValue());
    BaseCheck andCheck = new AndCheck(checks);
    return Maps.immutableEntry("and_expr", andCheck);
}

From source file:me.lucko.luckperms.bukkit.WorldCalculator.java

@Override
public MutableContextSet giveApplicableContext(Player subject, MutableContextSet accumulator) {
    String world = getWorld(subject);

    if (world != null) {
        accumulator.add(Maps.immutableEntry(WORLD_KEY, world));
    }//from   w  w w . j av a2s .  c o m

    return accumulator;
}

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

public WriteBatchImpl put(Slice key, Slice value) {
    Preconditions.checkNotNull(key, "key is null");
    Preconditions.checkNotNull(value, "value is null");
    batch.add(Maps.immutableEntry(key, value));
    approximateSize += 12 + key.length() + value.length();
    return this;
}

From source file:me.lucko.luckperms.bungee.BackendServerCalculator.java

@Override
public MutableContextSet giveApplicableContext(ProxiedPlayer subject, MutableContextSet accumulator) {
    String server = getServer(subject);

    if (server != null) {
        accumulator.add(Maps.immutableEntry(WORLD_KEY, server));
    }/*from   w  w  w .j a  v  a2  s  .c om*/

    return accumulator;
}

From source file:com.infinities.keystone4j.policy.reducer.WrapCheckReducer.java

@Override
protected Entry<String, BaseCheck> getEntry(List<Entry<String, BaseCheck>> entrys) {
    return Maps.immutableEntry("check", entrys.get(1).getValue());
}

From source file:org.jclouds.s3.xml.ErrorEntryHandler.java

@Override
public Map.Entry<String, DeleteResult.Error> getResult() {
    return Maps.immutableEntry(key, new DeleteResult.Error(code, message));
}

From source file:com.opentable.db.postgres.embedded.EmbeddedPostgreSQLController.java

/**
 * Each schema set has its own database cluster.  The template1 database has the schema preloaded so that
 * each test case need only create a new database and not re-invoke Migratory.
 *///from   w  ww .j ava 2 s. c om
private static synchronized Cluster getCluster(URI baseUrl, String[] personalities) throws IOException {
    final Entry<URI, Set<String>> key = Maps.immutableEntry(baseUrl,
            (Set<String>) ImmutableSet.copyOf(personalities));

    Cluster result = CLUSTERS.get(key);
    if (result != null) {
        return result;
    }

    result = new Cluster(EmbeddedPostgreSQL.start());

    final DBI dbi = new DBI(result.getPg().getTemplateDatabase());
    final Migratory migratory = new Migratory(new MigratoryConfig() {
    }, dbi, dbi);
    migratory.addLocator(new DatabasePreparerLocator(migratory, baseUrl));

    final MigrationPlan plan = new MigrationPlan();
    int priority = 100;

    for (final String personality : personalities) {
        plan.addMigration(personality, Integer.MAX_VALUE, priority--);
    }

    migratory.dbMigrate(plan);

    result.start();

    CLUSTERS.put(key, result);
    return result;
}

From source file:ec.tss.tsproviders.sdmx.engine.FluentDom.java

@Deprecated
public static Function<Node, Map.Entry<String, String>> toMapEntry() {
    return o -> Maps.immutableEntry(o.getNodeName(), o.getNodeValue());
}

From source file:com.palantir.atlasdb.keyvalue.impl.RowResults.java

public static <T> IterableView<Map.Entry<byte[], SortedMap<byte[], T>>> entriesViewFromRows(
        Iterable<RowResult<T>> rows) {
    return IterableView.of(rows).transform(new Function<RowResult<T>, Entry<byte[], SortedMap<byte[], T>>>() {
        @Override/*from   www .  j a v a  2 s  . com*/
        public Entry<byte[], SortedMap<byte[], T>> apply(RowResult<T> row) {
            return Maps.immutableEntry(row.getRowName(), row.getColumns());
        }
    });
}