List of usage examples for java.util Collections emptyMap
@SuppressWarnings("unchecked") public static final <K, V> Map<K, V> emptyMap()
From source file:com.replaymod.replaystudio.pathing.serialize.LegacyTimelineConverter.java
public static Map<String, Timeline> convert(PathingRegistry registry, ReplayFile replayFile) throws IOException { KeyframeSet[] keyframeSets = readAndParse(replayFile); if (keyframeSets == null) { return Collections.emptyMap(); }//w w w . j a v a 2 s . c om Map<String, Timeline> timelines = new LinkedHashMap<>(); for (KeyframeSet keyframeSet : keyframeSets) { timelines.put(keyframeSet.name, convert(registry, keyframeSet)); } return timelines; }
From source file:com.feilong.tools.net.httpclient3.NameValuePairUtil.java
/** * nameValuePairs?Map.//from w w w . j a v a 2s . c om * * @param nameValuePairs * the name value pairs * @return if (Validator.isNotNullOrEmpty(nameValuePairs)), will return Collections.emptyMap() * @since 1.0.9 */ public static Map<String, String> toMap(NameValuePair[] nameValuePairs) { if (Validator.isNotNullOrEmpty(nameValuePairs)) { Map<String, String> map = new TreeMap<String, String>(); for (NameValuePair nameValuePair : nameValuePairs) { map.put(nameValuePair.getName(), nameValuePair.getValue()); } return map; } return Collections.emptyMap(); }
From source file:com.ctriposs.rest4j.server.util.FileClassNameScanner.java
/** * Construct map from fully qualified class name to filename whose sources are found under a given source directory. * All source files are required to have an extension. * * @param sourceDir the source directory to scan * @param requiredExtension only include files whose extension equals to this parameter * null if no specific extension is required * @return map from fully qualified class name to filename for scanned source files. *//*from w ww .j a va 2s .co m*/ public static Map<String, String> scan(String sourceDir, String requiredExtension) { final String sourceDirWithSeparator = sourceDir.endsWith(File.separator) ? sourceDir : sourceDir + File.separator; final File dir = new File(sourceDirWithSeparator); if (!dir.exists() || !dir.isDirectory()) { return Collections.emptyMap(); } // suppress the warning because of inconsistent FileUtils interface @SuppressWarnings("unchecked") final Collection<File> files = (Collection<File>) FileUtils.listFiles(dir, null, true); final Map<String, String> classFileNames = new HashMap<String, String>(); final int prefixLength = sourceDirWithSeparator.length(); for (File f : files) { assert (f.exists() && f.isFile()); final int extensionIndex = f.getName().lastIndexOf('.'); final String filePath = f.getPath(); if (extensionIndex < 0 || !filePath.startsWith(sourceDirWithSeparator)) { continue; } final int reverseExtensionIndex = f.getName().length() - extensionIndex; final String classPathName = filePath.substring(prefixLength, filePath.length() - reverseExtensionIndex); if (classPathName.contains(".")) { // dot is not allowed in package name, thus not allowed in the directory path continue; } if (requiredExtension != null) { final String extension = f.getName().substring(extensionIndex + 1); if (!extension.equals(requiredExtension)) { continue; } } classFileNames.put(classPathName.replace(File.separator, "."), filePath); } return classFileNames; }
From source file:io.wcm.caravan.pipeline.extensions.hal.client.action.DeepEmbedLinksTest.java
private DeepEmbedLinks createAction(String relation) { return new DeepEmbedLinks("testService", relation, Collections.emptyMap()); }
From source file:com.greenline.hrs.admin.cache.redis.util.RedisInfoParser.java
/** * infoString?map//w ww.ja v a2s.c o m * * @param redisInfoStr * @return infoStrnullMap */ public static Map<String, String> infoMapParser(String redisInfoStr) { if (redisInfoStr == null || redisInfoStr.isEmpty()) { return Collections.emptyMap(); } String[] infoTokens = redisInfoStr.split(INFO_PROPERTY_DELIMITER); Map<String, String> infoMap = new HashMap<String, String>(infoTokens.length * 2); String[] propTokens = null; for (String infoToken : infoTokens) { propTokens = StringUtils.split(infoToken, INFO_PROPERTY_KY_DELIMITER); if (propTokens.length == PROPERTY_TOKENS_LEN) { infoMap.put(propTokens[PROP_KEY_IDX], propTokens[PROP_VALUE_IDX]); } } return infoMap; }
From source file:com.gae.ChannelAPIServlet.java
@Override public void init() throws ServletException { try {// w w w . j av a2 s .com channelService = ChannelServiceFactory.getChannelService(); } catch (ChannelFailureException e) { throw new RuntimeException(e); } try { CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory(); cache = cacheFactory.createCache(Collections.emptyMap()); } catch (CacheException e) { throw new RuntimeException(e); } }
From source file:net.navasoft.madcoin.backend.services.vo.NoFilteredFields.java
/** * Gets the filtered fields.// ww w .j av a 2 s. c om * * @return the filtered fields * @since 27/07/2014, 06:49:01 PM */ @Override public Map<String, Object> getFilteredFields() { return Collections.emptyMap(); }
From source file:com.weibo.api.motan.protocol.restful.support.RestfulUtil.java
public static Map<String, String> decodeAttachments(MultivaluedMap<String, String> headers) { String value = headers.getFirst(ATTACHMENT_HEADER); Map<String, String> result = Collections.emptyMap(); if (value != null && !value.isEmpty()) { result = new HashMap<String, String>(); for (String kv : value.split(";")) { String[] pair = kv.split("="); if (pair.length == 2) { result.put(StringTools.urlDecode(pair[0]), StringTools.urlDecode(pair[1])); }//from w ww.j a va 2s . com } } return result; }
From source file:com.hpcloud.mon.resource.serialization.SubAlarmExpressionSerializer.java
@Override public void serialize(AlarmSubExpression value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartObject();/* w ww. j a v a2 s .c om*/ jgen.writeStringField("function", value.getFunction().name()); jgen.writeStringField("metric_name", value.getMetricDefinition().name); jgen.writeObjectField("dimensions", value.getMetricDefinition().dimensions == null ? Collections.emptyMap() : value.getMetricDefinition().dimensions); jgen.writeStringField("operator", value.getOperator().name()); jgen.writeNumberField("threshold", value.getThreshold()); jgen.writeNumberField("period", value.getPeriod()); jgen.writeNumberField("periods", value.getPeriods()); jgen.writeEndObject(); }
From source file:com.haulmont.cuba.core.entity.LocaleHelper.java
public static Map<String, String> getLocalizedValuesMap(String localeBundle) { if (StringUtils.isNotEmpty(localeBundle)) { Properties localeProperties = loadProperties(localeBundle); if (localeProperties != null) { Map<String, String> map = new HashMap<>(); for (Map.Entry<Object, Object> entry : localeProperties.entrySet()) { map.put((String) entry.getKey(), (String) entry.getValue()); }//from w w w.j a va 2 s .c o m return map; } } return Collections.emptyMap(); }