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.mycompany.securitylogin.controller.UserController.java

@RequestMapping("/test")
@PreAuthorize("hasRole('ADMIN')")
@ResponseBody
public Map hello() {
    return Collections.emptyMap();
}

From source file:com.googlecode.jsonschema2pojo.integration.util.CodeGenerationHelper.java

public static File generate(String schema, String targetPackage) {
    Map<String, Object> configValues = Collections.emptyMap();
    return generate(schema, targetPackage, configValues);
}

From source file:net.openid.appauth.AdditionalParamsProcessor.java

static Map<String, String> checkAdditionalParams(@Nullable Map<String, String> params,
        @NonNull Set<String> builtInParams) {
    if (params == null) {
        return Collections.emptyMap();
    }//from  w w w.ja v a 2  s . c  o  m

    Map<String, String> additionalParams = new LinkedHashMap<>();
    for (Map.Entry<String, String> entry : params.entrySet()) {
        String key = entry.getKey();
        String value = entry.getValue();
        checkNotNull(key, "additional parameter keys cannot be null");
        checkNotNull(value, "additional parameter values cannot be null");

        checkArgument(!builtInParams.contains(key),
                "Parameter %s is directly supported via the authorization request builder, "
                        + "use the builder method instead",
                key);
        additionalParams.put(key, value);
    }

    return Collections.unmodifiableMap(additionalParams);
}

From source file:com.linecorp.armeria.server.docs.FieldInfo.java

static FieldInfo of(String name, RequirementType requirementType, TypeInfo type) {
    return of(name, requirementType, type, null, Collections.emptyMap());
}

From source file:com.axibase.tsd.util.AtsdUtil.java

public static Map<String, Double> toValuesMap(Object... metricNamesAndValues) {
    if (metricNamesAndValues == null || metricNamesAndValues.length == 0) {
        return Collections.emptyMap();
    }//w  ww . j  a v  a2s. com

    if (metricNamesAndValues.length % 2 == 1) {
        throw new IllegalArgumentException("Key without value");
    }

    Map<String, Double> result = new HashMap<String, Double>();
    for (int i = 0; i < metricNamesAndValues.length; i++) {
        result.put((String) metricNamesAndValues[i], (Double) metricNamesAndValues[++i]);
    }
    return result;
}

From source file:com.googlecode.jsonschema2pojo.integration.util.CodeGenerationHelper.java

public static File generate(URL schema, String targetPackage) {
    Map<String, Object> configValues = Collections.emptyMap();
    return generate(schema, targetPackage, configValues);
}

From source file:com.espertech.esper.core.start.EPStatementStartMethodHelperPrevious.java

public static Map<ExprPreviousNode, ExprPreviousEvalStrategy> compilePreviousNodeStrategies(
        ViewResourceDelegateVerified viewResourceDelegate, AgentInstanceViewFactoryChainContext[] contexts) {

    if (!viewResourceDelegate.isHasPrevious()) {
        return Collections.emptyMap();
    }/*from w ww .j  a  v  a  2  s .  c  o  m*/

    Map<ExprPreviousNode, ExprPreviousEvalStrategy> strategies = new HashMap<ExprPreviousNode, ExprPreviousEvalStrategy>();

    for (int streamNum = 0; streamNum < contexts.length; streamNum++) {

        // get stream-specific info
        ViewResourceDelegateVerifiedStream delegate = viewResourceDelegate.getPerStream()[streamNum];

        // obtain getter
        handlePrevious(delegate.getPreviousRequests(), contexts[streamNum].getPreviousNodeGetter(), strategies);
    }

    return strategies;
}

From source file:at.pagu.soldockr.core.ResultHelper.java

static Map<Field, Page<FacetEntry>> convertFacetQueryResponseToFacetPageMap(FacetQuery query,
        QueryResponse response) {//from ww  w .  java2  s .  co  m
    Assert.notNull(query, "Cannot convert response for 'null', query");

    if (!query.hasFacetOptions() || response == null) {
        return Collections.emptyMap();
    }
    Map<Field, Page<FacetEntry>> facetResult = new HashMap<Field, Page<FacetEntry>>();

    if (CollectionUtils.isNotEmpty(response.getFacetFields())) {
        int initalPageSize = query.getFacetOptions().getPageable().getPageSize();
        for (FacetField facetField : response.getFacetFields()) {
            if (facetField != null && StringUtils.isNotBlank(facetField.getName())) {
                Field field = new SimpleField(facetField.getName());
                if (CollectionUtils.isNotEmpty(facetField.getValues())) {
                    List<FacetEntry> pageEntries = new ArrayList<FacetEntry>(initalPageSize);
                    for (Count count : facetField.getValues()) {
                        if (count != null) {
                            pageEntries.add(new SimpleFacetEntry(field, count.getName(), count.getCount()));
                        }
                    }
                    facetResult.put(field, new FacetPage<FacetEntry>(pageEntries,
                            query.getFacetOptions().getPageable(), facetField.getValueCount()));
                } else {
                    facetResult.put(field, new FacetPage<FacetEntry>(Collections.<FacetEntry>emptyList(),
                            query.getFacetOptions().getPageable(), 0));
                }
            }
        }
    }
    return facetResult;
}

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

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

From source file:Main.java

/**
 * Join the two given maps to one by checking if one of the two maps already fulfills everything. Be aware that the
 * newly created collection is unmodifiable but will change if the underlying collections change!
 *
 * @param <K>    The key type//from  www  .j a v  a2  s  .  co m
 * @param <V>    The value type
 * @param first  The first {@link Map} to join
 * @param second The second {@link Map} to join
 *
 * @return A {@link Map} with the joined content (can be one of the given map if the other is empty or null)
 */
public static <K, V> Map<K, V> joinMapUnmodifiable(Map<K, V> first, Map<K, V> second) {
    if (first == null || first.isEmpty()) {
        if (second == null || second.isEmpty()) {
            return Collections.emptyMap();
        } else {
            return Collections.unmodifiableMap(second);
        }
    } else if (second == null || second.isEmpty()) {
        return Collections.unmodifiableMap(first);
    } else {
        Map<K, V> temp = new LinkedHashMap<K, V>(first.size() + second.size());
        temp.putAll(first);
        temp.putAll(second);
        return Collections.unmodifiableMap(temp);
    }
}