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.MysqlKfkaMapStore.java

@Override
public Iterable<Long> loadAllKeys() {
    return new CloseableIterable<Long>() {
        @Override//from w w  w.j  a  v  a2s  .c  o m
        protected CloseableIterator<Long> closeableIterator() {
            return tpl.queryForIter("SELECT id FROM kfka", Collections.emptyMap(), new RowMapper<Long>() {
                @Override
                public Long mapRow(ResultSet rs, int rowNum) throws SQLException {
                    return rs.getLong("id");
                }
            });
        }
    };
}

From source file:com.frank.search.solr.core.ResultHelper.java

static Map<Field, Page<FacetFieldEntry>> convertFacetQueryResponseToFacetPageMap(FacetQuery query,
        QueryResponse response) {//from   w ww .  j  a  va 2  s .  c  o m
    Assert.notNull(query, "Cannot convert response for 'null', query");

    if (!hasFacets(query, response)) {
        return Collections.emptyMap();
    }
    Map<Field, Page<FacetFieldEntry>> facetResult = new HashMap<Field, Page<FacetFieldEntry>>();

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

From source file:com.github.ukase.toolkit.fs.FileSource.java

@Override
public Map<String, Helper<?>> getHelpers() {
    return Collections.emptyMap();
}

From source file:com.github.triceo.robozonky.notifications.email.AbstractEmailingListener.java

Map<String, Object> getData(final T event) {
    return Collections.emptyMap();
}

From source file:com.github.woonsan.jackrabbit.migration.datastore.batch.MigrationJobExecutionStates.java

public Map<DataIdentifier, MigrationRecordExecutionStates> getExecutionStatesMap() {
    if (executionStatesMap == null) {
        return Collections.emptyMap();
    }/*from  w w  w. j a v  a  2s . co  m*/

    return Collections.unmodifiableMap(executionStatesMap);
}

From source file:org.Cherry.Modules.Security.Agent.UserAgent.java

@Path(value = URI_TOKEN)
@Produces(MediaType.TEXT_HTML)/*from www.  j a  v  a 2 s .  c o m*/
public Map<?, ?> get() {
    final HttpRequest request = Context.getInvocationContext().get(InvocationContext.Key.Request);

    debug("Invoked by [{}]", request);

    return Collections.emptyMap();
}

From source file:org.springframework.social.linkedin.api.impl.LinkedInErrorHandler.java

private Map<String, Object> extractErrorDetailsFromResponse(ClientHttpResponse response) throws IOException {
    ObjectMapper mapper = new ObjectMapper(new JsonFactory());
    try {/*from  ww w .j ava2 s  .com*/
        return mapper.<Map<String, Object>>readValue(response.getBody(),
                new TypeReference<Map<String, Object>>() {
                });
    } catch (JsonParseException e) {
        return Collections.emptyMap();
    }
}

From source file:org.hawkular.apm.server.api.utils.zipkin.BinaryAnnotationMappingStorage.java

private void loadMappings(String path) {
    try {//from   www  .j  a v a2 s.  c o m
        String file = readFile(new File(path));

        TypeReference<Map<String, BinaryAnnotationMapping>> typeReference = new TypeReference<Map<String, BinaryAnnotationMapping>>() {
        };

        ObjectMapper objectMapper = new ObjectMapper();
        JsonParser parser = objectMapper.getFactory().createParser(file);

        keyBasedMappings = Collections.unmodifiableMap(parser.readValueAs(typeReference));
    } catch (IOException ex) {
        log.errorf("Could not load Zipkin binary annotation mapping file %s", path);
        keyBasedMappings = Collections.emptyMap();
    }
}

From source file:com.openshift.internal.restclient.model.Container.java

public Container(ModelNode node) {
    this(node, Collections.emptyMap());
}