当前位置: 首页>>代码示例>>Java>>正文


Java Entry类代码示例

本文整理汇总了Java中java.util.Map.Entry的典型用法代码示例。如果您正苦于以下问题:Java Entry类的具体用法?Java Entry怎么用?Java Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Entry类属于java.util.Map包,在下文中一共展示了Entry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRangeQuery

import java.util.Map.Entry; //导入依赖的package包/类
private static RangeQueryBuilder createRangeQuery(String name, Map<String, Object> rangeOperation,
    Float boost) {

  RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery(name+RAW_APPEND);
  for (Map.Entry<String, Object> it : rangeOperation.entrySet()) {
    if (it.getKey().equalsIgnoreCase(LTE)) {
      rangeQueryBuilder.lte(it.getValue());
    } else if (it.getKey().equalsIgnoreCase(LT)) {
      rangeQueryBuilder.lt(it.getValue());
    } else if (it.getKey().equalsIgnoreCase(GTE)) {
      rangeQueryBuilder.gte(it.getValue());
    } else if (it.getKey().equalsIgnoreCase(GT)) {
      rangeQueryBuilder.gt(it.getValue());
    }
  }
  if (isNotNull(boost)) {
    return rangeQueryBuilder.boost(boost);
  }
  return rangeQueryBuilder;
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:21,代码来源:ElasticSearchUtil.java

示例2: toXml

import java.util.Map.Entry; //导入依赖的package包/类
/**
 * 微信下单map to xml
 * 
 * @param params
 *            参数
 * @return String
 */
public static String toXml(Map<String, String> params) {
	StringBuilder xml = new StringBuilder();
	xml.append("<xml>");
	for (Entry<String, String> entry : params.entrySet()) {
		String key = entry.getKey();
		String value = entry.getValue();
		// 略过空值
		if (StringUtils.isBlank(value))
			continue;
		xml.append("<").append(key).append(">");
		xml.append(entry.getValue());
		xml.append("</").append(key).append(">");
	}
	xml.append("</xml>");
	return xml.toString();
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:24,代码来源:WxPayment.java

示例3: toJsonableMap

import java.util.Map.Entry; //导入依赖的package包/类
public static Map<String,Object> toJsonableMap(Map<String,Object> stringKeyMap){
	Map<String,Object> jsonableMap = new HashMap<String,Object>();
	for (Entry<String, Object> es : stringKeyMap.entrySet()){
		String stringKey = es.getKey();
		if (stringKey.contains(".")){
			stringKey = stringKey.replace(".", "->");
			String[] arr = stringKey.split("->");
			String jsonKey = arr[0];
			String propKey = arr[1];
			Object obj = jsonableMap.get(jsonKey);
			Map<String,Object> objMap = null;
			if (Objects.isNull(obj)){
				objMap = new HashMap<String,Object>();
				jsonableMap.put(jsonKey, objMap);
			}else {
				objMap = (Map<String,Object>) obj;
			}
			objMap.put(propKey, es.getValue());
		}else{
			jsonableMap.put(stringKey, es.getValue());
		}
	}
	return jsonableMap;
}
 
开发者ID:x7-framework,项目名称:x7,代码行数:25,代码来源:BeanMapUtil.java

示例4: createNlpContext

import java.util.Map.Entry; //导入依赖的package包/类
protected NlpContext createNlpContext(final Result aiResponseResult) {
	final NlpContext result = new NlpContext();

	if (aiResponseResult.getMetadata() != null) {
		final NlpIntent nlpIntent = createNlpIntent(aiResponseResult);
		result.addIntent(nlpIntent);
	}

	if (aiResponseResult.getParameters() != null) {
		for (final Entry<String, JsonElement> entry : aiResponseResult.getParameters().entrySet()) {
			final NlpNamedEntity nlpNamedEntity = createNamedEntity(entry);
			result.addNamedEntity(nlpNamedEntity);
		}
	}

	return result;
}
 
开发者ID:nitroventures,项目名称:bot4j,代码行数:18,代码来源:ApiAiReceiveMessageFactoryImpl.java

示例5: create

import java.util.Map.Entry; //导入依赖的package包/类
static <KEY, RESULT> QuorumCall<KEY, RESULT> create(
    Map<KEY, ? extends ListenableFuture<RESULT>> calls) {
  final QuorumCall<KEY, RESULT> qr = new QuorumCall<KEY, RESULT>();
  for (final Entry<KEY, ? extends ListenableFuture<RESULT>> e : calls.entrySet()) {
    Preconditions.checkArgument(e.getValue() != null,
        "null future for key: " + e.getKey());
    Futures.addCallback(e.getValue(), new FutureCallback<RESULT>() {
      @Override
      public void onFailure(Throwable t) {
        qr.addException(e.getKey(), t);
      }

      @Override
      public void onSuccess(RESULT res) {
        qr.addResult(e.getKey(), res);
      }
    });
  }
  return qr;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:QuorumCall.java

示例6: generateCandidatesForLevel

import java.util.Map.Entry; //导入依赖的package包/类
private Set<InclusionDependency> generateCandidatesForLevel(int i) {
  Set<ColumnIdentifier> unaryIndNodes = new HashSet<>();
  // INDs from one table (dep & ref from same table) generate invalid INDs
  if (INCLUDE_INDS_FROM_ONE_TABLE) {
      unaryIndNodes = unaryIndMap.keySet();
  } else {
      unaryIndNodes = unaryIndMap.entrySet().stream()
              .filter(e -> !e.getKey().getTableIdentifier().equals(e.getValue().getTableIdentifier()))
              .map(Entry::getKey)
              .collect(Collectors.toSet());
  }

  Set<Set<ColumnIdentifier>> indsForLevel = Sets.combinations(unaryIndNodes,i);
  System.out.println("Combinations for level " + i + " : " + indsForLevel.toString());
  return indsForLevel.stream()
      .map(this::nodeToInd)
      .collect(Collectors.toSet());
}
 
开发者ID:HPI-Information-Systems,项目名称:AdvancedDataProfilingSeminar,代码行数:19,代码来源:Zigzag.java

示例7: assertCorrectEntriesInDatasetFileToLearningAlgorithmsMap

import java.util.Map.Entry; //导入依赖的package包/类
/**
 * Checks if the given map contains all {@link ILearningAlgorithm}'s which are using relative
 * datasets.
 * 
 * @param datasetFileToLearningAlgorithmsMap the map resulting after execution of the
 *           {@link DetermineApplicableAlgorithmsCommand}
 */
private void assertCorrectEntriesInDatasetFileToLearningAlgorithmsMap(
      Map<DatasetFile, List<ILearningAlgorithm>> datasetFileToLearningAlgorithmsMap) {
   Assert.assertEquals(1, datasetFileToLearningAlgorithmsMap.size());

   Set<String> allLearningAlgorithmsForRelativeDataset = getAllLearningAlgorithmClassNamesUsingRelativeDataset();

   for (Entry<DatasetFile, List<ILearningAlgorithm>> entry : datasetFileToLearningAlgorithmsMap.entrySet()) {
      Assert.assertEquals(allLearningAlgorithmsForRelativeDataset.size(), entry.getValue().size());
      for (ILearningAlgorithm learningAlgorithm : entry.getValue()) {
         String learningAlgorithmName = learningAlgorithm.toString();
         if (allLearningAlgorithmsForRelativeDataset.contains(learningAlgorithmName)) {
            allLearningAlgorithmsForRelativeDataset.remove(learningAlgorithmName);
         } else {
            Assert.fail(String.format(ERROR_ALGORITHM_NOT_USES_DATASET_BUT_IS_APPLICABLE, learningAlgorithmName,
                  DefaultDataset.class.getSimpleName()));
         }
      }
   }
}
 
开发者ID:Intelligent-Systems-Group,项目名称:jpl-framework,代码行数:27,代码来源:DetermineApplicableAlgorithmsCommandTest.java

示例8: filterGroupOrVersion

import java.util.Map.Entry; //导入依赖的package包/类
/**
 * 过滤一下:不符合标准的version, 含有: %
 * @return
 */
private Map<String, byte[]> filterGroupOrVersion(Map<String, byte[]> dbAdd) throws Exception {
    Map<String, byte[]> invalid = Maps.newHashMap();
    for (Entry<String, byte[]> entry: dbAdd.entrySet()) {
        try {
            URL url = URL.valueOf(entry.getKey());
            if (StringUtils.hasText(url.getParameter(Constants.VERSION_KEY))) {
                if(url.getParameter(Constants.VERSION_KEY).contains("%")){
                    logger.warn("节点{}的version包含不支持的字符, 过滤不同步到db", url.toFullString());
                    invalid.put(url.toFullString(), entry.getValue());
                }
            }
        } catch (Exception e) {
            logger.error("filterGroupOrVersion error, key:" + entry.getKey(), e);
            throw e;
        }
    }
    
    return Maps.difference(dbAdd, invalid).entriesOnlyOnLeft();
}
 
开发者ID:tiglabs,项目名称:jsf-core,代码行数:24,代码来源:ZkSynToDBServiceImpl.java

示例9: mapThrowableFlat

import java.util.Map.Entry; //导入依赖的package包/类
/** Mapping without checking the cause (done in mapThrowable). */
protected Integer mapThrowableFlat(Throwable throwable) {
    Class<? extends Throwable> throwableClass = throwable.getClass();
    Integer resId = throwableToMsgIdMap.get(throwableClass);
    if (resId == null) {
        Class<? extends Throwable> closestClass = null;
        Set<Entry<Class<? extends Throwable>, Integer>> mappings = throwableToMsgIdMap.entrySet();
        for (Entry<Class<? extends Throwable>, Integer> mapping : mappings) {
            Class<? extends Throwable> candidate = mapping.getKey();
            if (candidate.isAssignableFrom(throwableClass)) {
                if (closestClass == null || closestClass.isAssignableFrom(candidate)) {
                    closestClass = candidate;
                    resId = mapping.getValue();
                }
            }
        }

    }
    return resId;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:ExceptionToResourceMapping.java

示例10: removeStaleSpans

import java.util.Map.Entry; //导入依赖的package包/类
/**
 * Scans all of the cached spans in the in-memory representation, removing any for which files
 * no longer exist.
 */
private void removeStaleSpans() {
  Iterator<Entry<String, TreeSet<CacheSpan>>> iterator = cachedSpans.entrySet().iterator();
  while (iterator.hasNext()) {
    Entry<String, TreeSet<CacheSpan>> next = iterator.next();
    Iterator<CacheSpan> spanIterator = next.getValue().iterator();
    boolean isEmpty = true;
    while (spanIterator.hasNext()) {
      CacheSpan span = spanIterator.next();
      if (!span.file.exists()) {
        spanIterator.remove();
        if (span.isCached) {
          totalSpace -= span.length;
        }
        notifySpanRemoved(span);
      } else {
        isEmpty = false;
      }
    }
    if (isEmpty) {
      iterator.remove();
    }
  }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:28,代码来源:SimpleCache.java

示例11: LocaleStore

import java.util.Map.Entry; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param valueTextMap  the map of values to text to store, assigned and not altered, not null
 */
LocaleStore(Map<TextStyle, Map<Long, String>> valueTextMap) {
    this.valueTextMap = valueTextMap;
    Map<TextStyle, List<Entry<String, Long>>> map = new HashMap<>();
    List<Entry<String, Long>> allList = new ArrayList<>();
    for (Map.Entry<TextStyle, Map<Long, String>> vtmEntry : valueTextMap.entrySet()) {
        Map<String, Entry<String, Long>> reverse = new HashMap<>();
        for (Map.Entry<Long, String> entry : vtmEntry.getValue().entrySet()) {
            if (reverse.put(entry.getValue(), createEntry(entry.getValue(), entry.getKey())) != null) {
                // TODO: BUG: this has no effect
                continue;  // not parsable, try next style
            }
        }
        List<Entry<String, Long>> list = new ArrayList<>(reverse.values());
        Collections.sort(list, COMPARATOR);
        map.put(vtmEntry.getKey(), list);
        allList.addAll(list);
        map.put(null, allList);
    }
    Collections.sort(allList, COMPARATOR);
    this.parsable = map;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:DateTimeTextProvider.java

示例12: toXml

import java.util.Map.Entry; //导入依赖的package包/类
/**
 * 微信下单map to xml
 * 
 * @param params
 *            参数
 * @return {String}
 */
public static String toXml(Map<String, String> params) {
	StringBuilder xml = new StringBuilder();
	xml.append("<xml>");
	for (Entry<String, String> entry : params.entrySet()) {
		String key = entry.getKey();
		String value = entry.getValue();
		// 略过空值
		if (StrKit.isBlank(value))
			continue;
		xml.append("<").append(key).append(">");
		xml.append(entry.getValue());
		xml.append("</").append(key).append(">");
	}
	xml.append("</xml>");
	return xml.toString();
}
 
开发者ID:Javen205,项目名称:IJPay,代码行数:24,代码来源:PaymentKit.java

示例13: accept

import java.util.Map.Entry; //导入依赖的package包/类
@Override
public boolean accept(Object object, FailedReason failedReason) {
    if (null == object) {
        return false;
    }
    for (Entry<String, List<AbstractConditionValidator>> validators : validatorsMap.entrySet()) {
        List<AbstractConditionValidator> cs = validators.getValue();
        String fieldName = validators.getKey();
        Object fieldValue = fields.get(fieldName).get(object);
        for (AbstractConditionValidator abstractConditionValidator : cs) {
            if (!abstractConditionValidator.accept(fieldValue)) {
                failedReason.setReason(abstractConditionValidator.refuseReason()).setFieldName(fieldName);
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:wxz1211,项目名称:dooo,代码行数:19,代码来源:BeanAbstractFieldValidator.java

示例14: testAsMapGet

import java.util.Map.Entry; //导入依赖的package包/类
public void testAsMapGet() {
  for (K key : sampleKeys()) {
    List<V> expectedValues = new ArrayList<V>();
    for (Entry<K, V> entry : getSampleElements()) {
      if (entry.getKey().equals(key)) {
        expectedValues.add(entry.getValue());
      }
    }

    Collection<V> collection = multimap().asMap().get(key);
    if (expectedValues.isEmpty()) {
      assertNull(collection);
    } else {
      assertEqualIgnoringOrder(expectedValues, collection);
    }
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:18,代码来源:MultimapAsMapTester.java

示例15: tickTriangs

import java.util.Map.Entry; //导入依赖的package包/类
public void tickTriangs() {
    for (Entry<String, AddonPlayerInfo> entry : playerInfos.entrySet()) {
        EntityPlayer player = ServerUtils.getPlayer(entry.getKey());

        for (Integer freq : entry.getValue().triangSet) {
            double spinto;
            if (!RedstoneEther.server().isFreqOn(freq)) {
                spinto = -1;
            } else if (isRemoteOn(player, freq)) {
                spinto = -2;
            } else {
                Vector3 strengthvec = getBroadcastVector(player, freq);
                if (strengthvec == null)//in another dimension
                {
                    spinto = -2;//spin to a random place
                } else {
                    spinto = (player.rotationYaw + 180) * MathHelper.torad - Math.atan2(-strengthvec.x, strengthvec.z);//spin to the transmitter vec
                }
            }
            WRServerPH.sendTriangAngleTo(player, freq, (float) spinto);
        }
    }
}
 
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:24,代码来源:RedstoneEtherServerAddons.java


注:本文中的java.util.Map.Entry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。