List of usage examples for java.util Collections emptyMap
@SuppressWarnings("unchecked") public static final <K, V> Map<K, V> emptyMap()
From source file:org.spring.data.gemfire.config.RegionPutAllBeanPostProcessor.java
protected Map getRegionData() { return (regionData != null ? regionData : Collections.emptyMap()); }
From source file:com.example.oauth.Authentication.java
private OAuth2Request request() { final ClientApplicationEntity clientApplication = accessTokenEntity.getClientApplication(); return new OAuth2Request(Collections.emptyMap(), Long.toHexString(clientApplication.getId()), resourceUserAuthentication.getAuthorities(), true, accessToken.getScope(), Collections.singleton(ResourceConfig.RESOURCE_ID), clientApplication.getRedirectUri(), Collections.emptySet(), Collections.emptyMap()); }
From source file:ch.cyberduck.core.AbstractCache.java
public AbstractCache(int size) { if (size == Integer.MAX_VALUE) { // Unlimited impl = Collections.synchronizedMap(new LinkedHashMap<T, AttributedList<T>>()); reverse = Collections.synchronizedMap(new LinkedHashMap<CacheReference, T>()); } else if (size == 0) { impl = Collections.emptyMap(); reverse = Collections.emptyMap(); } else {/*from w ww. jav a2 s . c om*/ // Will inflate to the given size impl = Collections.synchronizedMap(new LRUMap<T, AttributedList<T>>(size)); reverse = Collections.synchronizedMap(new LinkedHashMap<CacheReference, T>()); } }
From source file:com.github.rnewson.couchdb.lucene.couchdb.DesignDocument.java
public Map<String, View> getAllViews() throws JSONException { if (fulltext == null) return Collections.emptyMap(); final Map<String, View> result = new HashMap<String, View>(); final Iterator<?> it = fulltext.keys(); while (it.hasNext()) { final Object key = it.next(); final String name = (String) key; final View view = getView(name); if (view != null) { result.put(name, view);// w w w . j a va2 s. c om } } return result; }
From source file:be.ordina.msdashboard.controllers.NodesControllerTest.java
@Test public void getDependenciesGraphJson() { doReturn(Collections.emptyMap()).when(graphRetriever).retrieve(); HttpEntity<Map<String, Object>> httpEntity = nodesController.getDependenciesGraphJson(); assertThat(httpEntity.getBody()).isEmpty(); }
From source file:io.fluo.webindex.data.fluo.UriCountExport.java
@Override protected Map<RowColumn, Bytes> generateData(String pageID, Optional<UriInfo> val) { if (val.orElse(UriInfo.ZERO).equals(UriInfo.ZERO)) { return Collections.emptyMap(); }// www. j av a 2s. c o m UriInfo uriInfo = val.get(); Map<RowColumn, Bytes> rcMap = new HashMap<>(); Bytes linksTo = Bytes.of("" + uriInfo.linksTo); rcMap.put(new RowColumn(createTotalRow(pageID, uriInfo.linksTo), Column.EMPTY), linksTo); String domain = URL.fromPageID(pageID).getReverseDomain(); String domainRow = encodeDomainRankPageId(domain, uriInfo.linksTo, pageID); rcMap.put(new RowColumn(domainRow, new Column(Constants.RANK, "")), linksTo); rcMap.put(new RowColumn("p:" + pageID, FluoConstants.PAGE_INCOUNT_COL), linksTo); return rcMap; }
From source file:ddf.catalog.transformer.html.HtmlMetacardTransformerTest.java
@Test(expected = CatalogTransformerException.class) public void testNullMetacardTransform() throws CatalogTransformerException { HtmlMetacardTransformer htmlTransformer = new HtmlMetacardTransformer(EMPTY_CATEGORY_LIST); htmlTransformer.transform(null, Collections.emptyMap()); }
From source file:io.apiman.cli.util.DeclarativeUtil.java
/** * Load the Declaration from the given Path, using the mapper provided. * * @param path the Path to the declaration * @param mapper the Mapper to use//from w w w. jav a2s . com * @param properties property placeholders to resolve * @return the Declaration */ public static Declaration loadDeclaration(Path path, ObjectMapper mapper, Collection<String> properties) { final Map<String, String> parsedProperties = BeanUtil.parseReplacements(properties); try (InputStream is = Files.newInputStream(path)) { String fileContents = CharStreams.toString(new InputStreamReader(is)); LOGGER.trace("Declaration file raw: {}", fileContents); Declaration declaration = loadDeclaration(mapper, fileContents, parsedProperties); // check for the presence of shared properties in the declaration final Map<String, String> sharedProperties = ofNullable(declaration.getShared()) .map(SharedItems::getProperties).orElse(Collections.emptyMap()); if (sharedProperties.size() > 0) { LOGGER.trace("Resolving {} shared placeholders", sharedProperties.size()); parsedProperties.putAll(sharedProperties); // this is not very efficient, as it requires parsing the declaration twice declaration = loadDeclaration(mapper, fileContents, parsedProperties); } return declaration; } catch (IOException e) { throw new DeclarativeException(e); } }
From source file:com.jxt.web.mapper.AnnotationMapper.java
@Override public Map<Long, List<AnnotationBo>> mapRow(Result result, int rowNum) throws Exception { if (result.isEmpty()) { return Collections.emptyMap(); }/* w w w. j av a2 s . c o m*/ final Cell[] rawCells = result.rawCells(); Map<Long, List<AnnotationBo>> annotationList = new HashMap<>(); for (Cell cell : rawCells) { final Buffer buffer = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); long spanId = buffer.readLong(); if (CellUtil.matchingFamily(cell, HBaseTables.TRACES_CF_ANNOTATION)) { final int valueLength = cell.getValueLength(); if (valueLength == 0) { continue; } buffer.setOffset(cell.getValueOffset()); List<AnnotationBo> annotationBoList = annotationDecoder.decode(buffer); if (CollectionUtils.isNotEmpty(annotationBoList)) { annotationList.put(spanId, annotationBoList); } } } return annotationList; }
From source file:com.sdl.odata.unmarshaller.json.ODataJsonActionParser.java
@Override public Map<String, Object> parseRequestBody(String body) throws IOException { // The very primitive parser to parse simple key-value parameters if (isNullOrEmpty(body)) { return Collections.emptyMap(); }/*from w w w . ja v a 2 s. com*/ Map<String, Object> parsedMap = OBJECT_MAPPER.readValue(body, new TypeReference<HashMap<String, Object>>() { }); LOG.debug("The request body is parsed to map: {}", parsedMap); return parsedMap; }