本文整理汇总了Java中java.util.LinkedHashMap.containsKey方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedHashMap.containsKey方法的具体用法?Java LinkedHashMap.containsKey怎么用?Java LinkedHashMap.containsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.LinkedHashMap
的用法示例。
在下文中一共展示了LinkedHashMap.containsKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setGeolocation
import java.util.LinkedHashMap; //导入方法依赖的package包/类
/**
* Methods to deal with nested TagEvent JSON structure. Jackson black magic can deal with it using
* annotations. So some attributes have to be deserialized in an alternative way.
* @param geolocation
*/
@JsonSetter("geolocation")
public void setGeolocation(LinkedHashMap geolocation) {
try {
if (geolocation.containsKey("zone"))
this.geoZone= geolocation.get("zone").toString();
if (geolocation.containsKey("latitude"))
this.latitude= Double.parseDouble(geolocation.get("latitude").toString());
if (geolocation.containsKey("longitude"))
this.longitude= Double.parseDouble(geolocation.get("longitude").toString());
if (geolocation.containsKey("region") && geolocation.get("region") instanceof LinkedHashMap) {
LinkedHashMap<String, String> region= (LinkedHashMap) geolocation.get("region");
if (region.containsKey("country"))
this.geoRegionCountry= region.get("country").toString();
if (region.containsKey("locality"))
this.geoRegionLocality= region.get("locality").toString();
}
} catch (Exception ex) {
log.error("Unable to parse the TagEvent(geolocation): " + geolocation + ", Exception: " + ex.getMessage());
}
}
示例2: mergePathDefinitions
import java.util.LinkedHashMap; //导入方法依赖的package包/类
public Map<String, Path> mergePathDefinitions(Swagger target, Swagger source) {
LinkedHashMap<String, Path> mergedDefinitions = new LinkedHashMap<>();
mergedDefinitions.putAll(target.getPaths());
Map<String, Path> pathsToBeMerged = source.getPaths();
for (Entry<String, Path> entry : pathsToBeMerged.entrySet()) {
if (!mergedDefinitions.containsKey(entry.getKey())) {
logger.info("source path %s is not present in existing Swagger JSON file.", entry.getKey());
mergedDefinitions.put(entry.getKey(), entry.getValue());
} else {
logger.info("source path %s is present in existing Swagger JSON file...merging operations", entry.getKey());
Map<HttpMethod, Operation> modifedOperations = mergeOperationPaths(mergedDefinitions.get(entry.getKey()),
entry.getValue());
for(Entry<HttpMethod, Operation> operation : modifedOperations.entrySet()){
mergedDefinitions.get(entry.getKey()).set(operation.getKey().name().toLowerCase(), operation.getValue());
}
}
}
return mergedDefinitions;
}
示例3: findNewestParticipatingLeaves
import java.util.LinkedHashMap; //导入方法依赖的package包/类
private void findNewestParticipatingLeaves(Course course, Staff staff, LinkedHashMap<Long, Course> resultMap) {
if (!resultMap.containsKey(course.getId())) {
resultMap.put(course.getId(), course);
if (course.isExpires()) {
Collection<Course> renewals = course.getRenewals();
if (renewals != null && renewals.size() > 0) {
Iterator<Course> it = renewals.iterator();
while (it.hasNext()) {
Course renewal = it.next();
if (getCachedParticiaptionCourseIds(staff).contains(renewal.getId())) {
findNewestParticipatingLeaves(renewal, staff, resultMap);
}
}
}
}
}
}
示例4: getStatsCardsByPopulationCrous
import java.util.LinkedHashMap; //导入方法依赖的package包/类
public LinkedHashMap<String, String> getStatsCardsByPopulationCrous (List<Object[]> objectList){
LinkedHashMap<String, String> mapCards = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> finalMap = new LinkedHashMap<String, String>();
if(!objectList.isEmpty()){
for(Object[] r : objectList){
mapCards.put(r[0].toString(), r[1].toString());
}
LinkedHashMap<String, String> mapCrous = this.getPopulationCrous();
for(Map.Entry<String, String> entry : mapCrous.entrySet()){
if(mapCards.containsKey(entry.getKey())){
finalMap.put(entry.getKey(), mapCards.get(entry.getKey()));
}else{
finalMap.put(entry.getKey(), "0");
}
}
}
return finalMap;
}
示例5: doneParsing
import java.util.LinkedHashMap; //导入方法依赖的package包/类
/** Do any post-parsing processig. */
void doneParsing() {
status = 3;
LinkedHashMap<String,Open> copy = new LinkedHashMap<String,Open>(opens);
opens.clear();
for(Map.Entry<String,Open> e: copy.entrySet()) {
String a = e.getKey();
Open m = e.getValue();
if (a.indexOf('$')>=0) {
String base = m.filename;
int i = base.lastIndexOf('/');
if (i>=0) base = base.substring(i+1);
if (!copy.containsKey(base) && !opens.containsKey(base)) {
for(i=0; i<base.length(); i++) {
char c = base.charAt(i);
if ((c>='a' && c<='z') || (c>='A' && c<='Z')) continue;
if (i!=0 && ((c>='0' && c<='9') || c=='_' || c=='\'' || c=='\"')) continue;
break;
}
if (i>=base.length()) a = base;
}
}
opens.put(a, new Open(m.pos, m.isPrivate, a, m.args, m.filename));
}
}
示例6: getClassPathEntries
import java.util.LinkedHashMap; //导入方法依赖的package包/类
@VisibleForTesting
static ImmutableMap<File, ClassLoader> getClassPathEntries(ClassLoader classloader) {
LinkedHashMap<File, ClassLoader> entries = Maps.newLinkedHashMap();
// Search parent first, since it's the order ClassLoader#loadClass() uses.
ClassLoader parent = classloader.getParent();
if (parent != null) {
entries.putAll(getClassPathEntries(parent));
}
if (classloader instanceof URLClassLoader) {
URLClassLoader urlClassLoader = (URLClassLoader) classloader;
for (URL entry : urlClassLoader.getURLs()) {
if (entry.getProtocol().equals("file")) {
File file = toFile(entry);
if (!entries.containsKey(file)) {
entries.put(file, classloader);
}
}
}
}
return ImmutableMap.copyOf(entries);
}
示例7: getATsFromBlock
import java.util.LinkedHashMap; //导入方法依赖的package包/类
public static LinkedHashMap< ByteBuffer , byte[] > getATsFromBlock( byte[] blockATs ) throws AT_Exception
{
if ( blockATs.length > 0 )
{
if ( blockATs.length % (getCostOfOneAT() ) != 0 )
{
throw new AT_Exception("blockATs must be a multiple of cost of one AT ( " + getCostOfOneAT() +" )" );
}
}
ByteBuffer b = ByteBuffer.wrap( blockATs );
b.order( ByteOrder.LITTLE_ENDIAN );
byte[] temp = new byte[ AT_Constants.AT_ID_SIZE ];
LinkedHashMap< ByteBuffer , byte[] > ats = new LinkedHashMap<>();
while ( b.position() < b.capacity() )
{
b.get( temp , 0 , temp.length );
byte[] md5 = new byte[ 16 ];
b.get( md5 , 0 , md5.length );
ByteBuffer atId = ByteBuffer.allocate(AT_Constants.AT_ID_SIZE);
atId.put(temp);
atId.clear();
if(ats.containsKey(atId)) {
throw new AT_Exception("AT included in block multiple times");
}
ats.put( atId , md5 );
}
if ( b.position() != b.capacity() )
{
throw new AT_Exception("bytebuffer not matching");
}
return ats;
}
示例8: addToExport
import java.util.LinkedHashMap; //导入方法依赖的package包/类
private void addToExport(LinkedHashMap<String, ModelData<?>> export, ModelData<?> model) {
try {
String key = model.getKind().getModelName()+":"+model.getData().getId();
if ( !export.containsKey(key) ) {
export.put(key, model);
}
} catch (IOException e) {
// This should not no occur since the model does not need to be deserialized
throw new RuntimeException(e);
}
}
示例9: updateComponentStatus
import java.util.LinkedHashMap; //导入方法依赖的package包/类
/**
* Updates the status of a component.
*/
public void updateComponentStatus(){
Component component = this.getCastedModel();
LinkedHashMap<String, Object> properties = component.getProperties();
String statusName = Component.Props.VALIDITY_STATUS.getValue();
if(properties.containsKey(statusName)){
((ComponentFigure)this.getFigure()).setPropertyStatus((String)properties.get(statusName));
this.getFigure().repaint();
}
}
示例10: doneParsing
import java.util.LinkedHashMap; //导入方法依赖的package包/类
/** Do any post-parsing processig. */
void doneParsing() {
status = 3;
LinkedHashMap<String,Open> copy = new LinkedHashMap<String,Open>(opens);
opens.clear();
for (Map.Entry<String,Open> e : copy.entrySet()) {
String a = e.getKey();
Open m = e.getValue();
if (a.indexOf('$') >= 0) {
String base = m.filename;
int i = base.lastIndexOf('/');
if (i >= 0)
base = base.substring(i + 1);
if (!copy.containsKey(base) && !opens.containsKey(base)) {
for (i = 0; i < base.length(); i++) {
char c = base.charAt(i);
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
continue;
if (i != 0 && ((c >= '0' && c <= '9') || c == '_' || c == '\'' || c == '\"'))
continue;
break;
}
if (i >= base.length())
a = base;
}
}
opens.put(a, new Open(m.pos, m.isPrivate, a, m.args, m.filename));
}
}
示例11: organizeEntries
import java.util.LinkedHashMap; //导入方法依赖的package包/类
/**
* Organizes the valid data extracted from the log entries into LinkedHashMap.
*
* @param store
* A global LinkedHashMap containing the processing elements (with
* time in milliseconds) in hierarchical structure.
* @param matchedPR
* A PR matching the given search string.
* @param bTime
* Time taken by the specific processing element.
* @param docName
* Name of the document being processed.
*/
@SuppressWarnings("unchecked")
private void organizeEntries(LinkedHashMap<String, Object> store,
String matchedPR, String bTime, String docName) {
allDocs.add(docName);
if (store.containsKey(matchedPR)) {
((LinkedHashMap<String, Object>) store.get(matchedPR))
.put(docName, bTime);
} else {
LinkedHashMap<String, Object> tempLHM = new LinkedHashMap<String, Object>();
tempLHM.put(docName, bTime);
store.put(matchedPR, tempLHM);
}
}
示例12: getNamedParameters
import java.util.LinkedHashMap; //导入方法依赖的package包/类
public LinkedHashSet<NamedParameter> getNamedParameters(String resource, boolean excludeOverriden) throws Exception {
LinkedHashMap<String, NamedParameter> namedParameters = new LinkedHashMap<String, NamedParameter>();
Method method = getAnnotatedMethod(resource);
if (method != null) {
MethodParameterNames annotation = method.getAnnotation(MethodParameterNames.class);
String[] parameterNames = null;
if (annotation != null) {
parameterNames = annotation.value();
}
Class[] parameterTypes = method.getParameterTypes();
if (parameterNames != null && parameterTypes != null) {
for (int i = 0; i < parameterNames.length; i++) {
namedParameters.put(parameterNames[i], new NamedParameter(parameterNames[i], parameterTypes[i]));
}
}
}
Iterator<Entry<String, Object>> it = defaults.entrySet().iterator();
while (it.hasNext()) {
Entry<String, Object> defaultParameter = it.next();
if (!namedParameters.containsKey(defaultParameter.getKey())) {
namedParameters.put(defaultParameter.getKey(), new NamedParameter(defaultParameter.getKey(), defaultParameter.getValue().getClass()));
}
}
it = overrides.entrySet().iterator();
while (it.hasNext()) {
Entry<String, Object> overrideParameter = it.next();
namedParameters.put(overrideParameter.getKey(), new NamedParameter(overrideParameter.getKey(), overrideParameter.getValue().getClass()));
}
if (excludeOverriden) {
it = overrides.entrySet().iterator();
while (it.hasNext()) {
namedParameters.remove(it.next().getKey());
}
}
return new LinkedHashSet<NamedParameter>(namedParameters.values());
}
示例13: recreateFolderHierarchy
import java.util.LinkedHashMap; //导入方法依赖的package包/类
private void recreateFolderHierarchy(LinkedHashMap<Long, Bookmark> idMap) {
for (Bookmark bookmark : idMap.values()) {
if (bookmark.mId == ROOT_FOLDER_ID) continue;
// Look for invalid parent ids and self-cycles.
if (!idMap.containsKey(bookmark.mParentId) || bookmark.mParentId == bookmark.mId) {
bookmark.mParent = idMap.get(ROOT_FOLDER_ID);
bookmark.mParent.mEntries.add(bookmark);
continue;
}
bookmark.mParent = idMap.get(bookmark.mParentId);
bookmark.mParent.mEntries.add(bookmark);
}
}
示例14: findNewestLeaves
import java.util.LinkedHashMap; //导入方法依赖的package包/类
private static void findNewestLeaves(Course course, LinkedHashMap<Long, Course> resultMap) {
if (!resultMap.containsKey(course.getId())) {
resultMap.put(course.getId(), course);
if (course.isExpires()) {
Collection<Course> renewals = course.getRenewals();
if (renewals != null && renewals.size() > 0) {
Iterator<Course> it = renewals.iterator();
while (it.hasNext()) {
findNewestLeaves(it.next(), resultMap);
}
}
}
}
}
示例15: resolveMessageExtractors
import java.util.LinkedHashMap; //导入方法依赖的package包/类
protected LinkedHashMap<String, FieldExtractor<MessageInfoHolder, ?>> resolveMessageExtractors(
String[] projection, int count) {
LinkedHashMap<String, FieldExtractor<MessageInfoHolder, ?>> extractors =
new LinkedHashMap<String, FieldExtractor<MessageInfoHolder, ?>>();
for (String field : projection) {
if (extractors.containsKey(field)) {
continue;
}
if (MessageColumns._ID.equals(field)) {
extractors.put(field, new IdExtractor());
} else if (MessageColumns._COUNT.equals(field)) {
extractors.put(field, new CountExtractor<MessageInfoHolder>(count));
} else if (MessageColumns.SUBJECT.equals(field)) {
extractors.put(field, new SubjectExtractor());
} else if (MessageColumns.SENDER.equals(field)) {
extractors.put(field, new SenderExtractor());
} else if (MessageColumns.SENDER_ADDRESS.equals(field)) {
extractors.put(field, new SenderAddressExtractor());
} else if (MessageColumns.SEND_DATE.equals(field)) {
extractors.put(field, new SendDateExtractor());
} else if (MessageColumns.PREVIEW.equals(field)) {
extractors.put(field, new PreviewExtractor());
} else if (MessageColumns.URI.equals(field)) {
extractors.put(field, new UriExtractor());
} else if (MessageColumns.DELETE_URI.equals(field)) {
extractors.put(field, new DeleteUriExtractor());
} else if (MessageColumns.UNREAD.equals(field)) {
extractors.put(field, new UnreadExtractor());
} else if (MessageColumns.ACCOUNT.equals(field)) {
extractors.put(field, new AccountExtractor());
} else if (MessageColumns.ACCOUNT_COLOR.equals(field)) {
extractors.put(field, new AccountColorExtractor());
} else if (MessageColumns.ACCOUNT_NUMBER.equals(field)) {
extractors.put(field, new AccountNumberExtractor());
} else if (MessageColumns.HAS_ATTACHMENTS.equals(field)) {
extractors.put(field, new HasAttachmentsExtractor());
} else if (MessageColumns.HAS_STAR.equals(field)) {
extractors.put(field, new HasStarExtractor());
} else if (MessageColumns.INCREMENT.equals(field)) {
extractors.put(field, new IncrementExtractor());
}
}
return extractors;
}