Example usage for java.util Collections emptyMap

List of usage examples for java.util Collections emptyMap

Introduction

In this page you can find the example usage for java.util Collections emptyMap.

Prototype

@SuppressWarnings("unchecked")
public static final <K, V> Map<K, V> emptyMap() 

Source Link

Document

Returns an empty map (immutable).

Usage

From source file:com.ethlo.kfka.mysql.MysqlKfkaCounterStore.java

@Override
public long latest() {
    final Long latest = tpl.queryForObject("SELECT MAX(id) FROM kfka", Collections.emptyMap(), Long.class);
    return latest != null ? latest : 0;
}

From source file:spring.travel.site.auth.CookieDecoder.java

public Map<String, String> decode(String cookie) throws AuthException {
    String[] parts = cookie.split("-", 2);
    if (parts.length != 2) {
        return Collections.emptyMap();
    }//from   w  w  w . j a v a 2s . c  o m

    String signature = parts[0];
    String encoded = parts[1];

    if (!verifier.verify(encoded, signature)) {
        return Collections.emptyMap();
    }

    return Arrays.asList(encoded.split("&")).stream().map(keyValue -> keyValue.split("=")).collect(
            Collectors.toMap(arr -> urlDecode(arr[0]), arr -> arr.length > 1 ? urlDecode(arr[1]) : ""));
}

From source file:Main.java

/**
 * Copies the given {@link Map} containing another {@link Map} into a new
 * {@link Map}.//from ww  w  .  j av  a2 s  .  c om
 * 
 * @param <A>
 *            the type of the keys of the outer map
 * @param <B>
 *            the type of the keys of the map, that is the value of the
 *            outer map
 * @param <C>
 *            the type of the values of the map, that is the value of the
 *            outer map
 * @param data
 *            the given map
 * @return If the given map was empty, a {@link Collections#emptyMap()} is
 *         returned<br>
 *         If the given map contained only one entry, a
 *         {@link Collections#singletonMap(Object, Object)}, containing
 *         said entry, is returned <br>
 *         If the given map contained more than one element, a
 *         {@link Collections#unmodifiableMap(Map)}, containing the entries
 *         of the given map, is returned.
 */
public static <A, B, C> Map<A, Map<B, C>> copyDeep(Map<A, Map<B, C>> data) {
    final int size = data.size();

    switch (size) {
    case 0:
        return Collections.emptyMap();
    case 1:
        final A key = data.keySet().iterator().next();
        return Collections.singletonMap(key, copy(data.get(key)));
    default:
        final Map<A, Map<B, C>> newData = new HashMap<A, Map<B, C>>();
        for (Map.Entry<A, Map<B, C>> entry : data.entrySet()) {
            newData.put(entry.getKey(), copy(entry.getValue()));
        }
        return Collections.unmodifiableMap(newData);
    }
}

From source file:edu.cornell.mannlib.vitro.webapp.config.DummyConfigurationProperties.java

@Override
public Map<String, String> getPropertyMap() {
    log.warn("ConfigurationProperties has not been initialized: " + "getPropertyMap()");
    return Collections.emptyMap();
}

From source file:edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.SimpleHttpServletRequestWrapper.java

@Override
public Map<String, List<FileItem>> getFiles() {
    return Collections.emptyMap();
}

From source file:bazaar4idea.command.BzrShowConfigCommand.java

public Map<String, String> execute(VirtualFile repo) {
    if (repo == null) {
        return Collections.emptyMap();
    }//from  w w w  .j  a  v a2s.com

    BzrStandardResult result = ShellCommandService.getInstance(project).execute2(repo, "showconfig", null);

    Map<String, String> options = new HashMap<String, String>();
    for (String line : result.getStdOutAsLines()) {
        String[] option = StringUtils.splitPreserveAllTokens(line, '=');
        if (option.length == 2) {
            options.put(option[0].trim(), option[1].trim());
        }
    }
    return options;
}

From source file:com.synopsys.integration.executable.Executable.java

public static Executable create(final File workingDirectory, final String command,
        final List<String> arguments) {
    return create(workingDirectory, Collections.emptyMap(), command, arguments);
}

From source file:bazaar4idea.command.BzrResolveCommand.java

public Map<BzrFile, BzrResolveStatusEnum> list(VirtualFile repo) {
    if (repo == null) {
        return Collections.emptyMap();
    }/*from  www  .j  a v a 2  s. c  om*/

    BzrStandardResult result = ShellCommandService.getInstance(project).execute2(repo, "resolve",
            Arrays.asList("--list"));

    Map<BzrFile, BzrResolveStatusEnum> resolveStatus = new HashMap<BzrFile, BzrResolveStatusEnum>();
    for (String line : result.getStdOutAsLines()) {
        if (StringUtils.isBlank(line) || line.length() < ITEM_COUNT) {
            continue;
        }
        BzrResolveStatusEnum status = BzrResolveStatusEnum.valueOf(line.charAt(0));
        if (status != null) {
            File ioFile = new File(repo.getPath(), line.substring(2));
            resolveStatus.put(new BzrFile(repo, ioFile), status);
        }
    }
    return resolveStatus;
}

From source file:io.syndesis.model.integration.SimpleStep.java

@Value.Default
default Map<String, String> getConfiguredProperties() {
    return Collections.emptyMap();
}

From source file:fr.acxio.tools.agia.io.ExpressionResourceFactory.java

@Override
public Resource getResource() throws ResourceCreationException {
    return getResource(Collections.emptyMap());
}