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:io.atomix.core.multimap.AtomicMultimapType.java

@Override
public Namespace namespace() {
    return Namespace.builder().register(PrimitiveType.super.namespace()).nextId(Namespaces.BEGIN_USER_CUSTOM_ID)
            .register(Versioned.class).register(ArrayList.class)
            .register(Maps.immutableEntry("", "").getClass()).register(IteratorBatch.class).build();
}

From source file:co.cask.tigon.sql.internal.StreamConfigGenerator.java

public Map.Entry<String, String> generateHostIfq() {
    String contents = createLocalHostIfq();
    return Maps.immutableEntry(HOSTNAME, contents);
}

From source file:com.hippo.leveldb.impl.SnapshotSeekingIterator.java

@Override
protected Entry<Slice, Slice> getNextElement() {
    if (!iterator.hasNext()) {
        return null;
    }/*from  www .  j  a va  2s.co  m*/

    Entry<InternalKey, Slice> next = iterator.next();

    // find the next user entry after the key we are about to return
    findNextUserEntry(next.getKey().getUserKey());

    return Maps.immutableEntry(next.getKey().getUserKey(), next.getValue());
}

From source file:me.lucko.luckperms.bukkit.processors.ChildProcessor.java

@Override
public void updateBacking(Map<String, Boolean> map) {
    childPermissions.clear();//from   ww  w .  ja  v a2s .  co  m
    for (Map.Entry<String, Boolean> e : map.entrySet()) {
        Map<String, Boolean> children = provider.getPermissions()
                .get(Maps.immutableEntry(e.getKey(), e.getValue()));
        if (children != null) {
            childPermissions.putAll(children);
        }
    }
}

From source file:me.lucko.luckperms.common.treeview.TreeNode.java

public ImmutableTreeNode makeImmutableCopy() {
    if (children == null) {
        return new ImmutableTreeNode(null);
    } else {//from  www.java  2 s  .  com
        return new ImmutableTreeNode(children.entrySet().stream()
                .map(e -> Maps.immutableEntry(e.getKey(), e.getValue().makeImmutableCopy())));
    }
}

From source file:org.obiba.mica.micaConfig.rest.DataAccessResource.java

@GET
@Path("/form")
@Timed//from   w  w  w  . j  ava  2  s. com
public Mica.DataAccessFormDto getDataAccessForm(@QueryParam("lang") String lang) {
    Optional<DataAccessForm> d = dataAccessFormService.find();

    if (!d.isPresent())
        throw NoSuchDataAccessFormException.withDefaultMessage();

    DataAccessForm dataAccessForm = d.get();
    Mica.DataAccessFormDto.Builder builder = Mica.DataAccessFormDto.newBuilder(dtos.asDto(dataAccessForm))
            .clearProperties().clearPdfTemplates();

    String langTag = !Strings.isNullOrEmpty(lang) ? Locale.forLanguageTag(lang).toLanguageTag()
            : LanguageTag.UNDETERMINED;

    Map<String, LocalizedString> properties = dataAccessForm.getProperties().entrySet().stream()
            .map(e -> Maps.immutableEntry(e.getKey(),
                    new LocalizedString().forLanguageTag(langTag, e.getValue().get(langTag))))
            .collect(toMap(Map.Entry::getKey, Map.Entry::getValue));

    builder.addAllProperties(dtos.asDtoList(properties));

    return builder.build();
}

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

@EventHandler
public void onPlayerServerSwitch(ServerSwitchEvent e) {
    pushUpdate(e.getPlayer(), Maps.immutableEntry("null", "null"),
            Maps.immutableEntry(WORLD_KEY, getServer(e.getPlayer())));
}

From source file:me.lucko.luckperms.common.storage.dao.file.FileUuidCache.java

/**
 * Adds a mapping to the cache/*from w ww . ja va 2  s.c  o m*/
 *
 * @param uuid the uuid of the player
 * @param username the username of the player
 */
public void addMapping(UUID uuid, String username) {
    lookupMap.put(username.toLowerCase(), Maps.immutableEntry(uuid, DateUtil.unixSecondsNow()));
}

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

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

From source file:ninja.leaping.permissionsex.sponge.SpongeCommander.java

@Override
public Optional<Map.Entry<String, String>> getSubjectIdentifier() {
    return Optional.of(Maps.immutableEntry(commandSource.getContainingCollection().getIdentifier(),
            commandSource.getIdentifier()));
}