java类java.util.Map.Entry的实例源码

ElasticSearchUtil.java 文件源码 项目:sunbird-utils 阅读 25 收藏 0 点赞 0 评论 0
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;
}
WxPayment.java 文件源码 项目:automat 阅读 19 收藏 0 点赞 0 评论 0
/**
 * 微信下单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();
}
BeanMapUtil.java 文件源码 项目:x7 阅读 29 收藏 0 点赞 0 评论 0
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;
}
ApiAiReceiveMessageFactoryImpl.java 文件源码 项目:bot4j 阅读 20 收藏 0 点赞 0 评论 0
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;
}
QuorumCall.java 文件源码 项目:hadoop 阅读 25 收藏 0 点赞 0 评论 0
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;
}
Zigzag.java 文件源码 项目:AdvancedDataProfilingSeminar 阅读 21 收藏 0 点赞 0 评论 0
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());
}
DetermineApplicableAlgorithmsCommandTest.java 文件源码 项目:jpl-framework 阅读 22 收藏 0 点赞 0 评论 0
/**
 * 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()));
         }
      }
   }
}
ZkSynToDBServiceImpl.java 文件源码 项目:jsf-core 阅读 17 收藏 0 点赞 0 评论 0
/**
 * 过滤一下:不符合标准的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();
}
ExceptionToResourceMapping.java 文件源码 项目:GitHub 阅读 21 收藏 0 点赞 0 评论 0
/** 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;
}
SimpleCache.java 文件源码 项目:airgram 阅读 33 收藏 0 点赞 0 评论 0
/**
 * 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();
    }
  }
}
DateTimeTextProvider.java 文件源码 项目:OpenJSharp 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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;
}
ExceptionToResourceMapping.java 文件源码 项目:KUtils-master 阅读 26 收藏 0 点赞 0 评论 0
/** 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;
}
PaymentKit.java 文件源码 项目:IJPay 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 微信下单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();
}
BeanAbstractFieldValidator.java 文件源码 项目:dooo 阅读 22 收藏 0 点赞 0 评论 0
@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;
}
MultimapAsMapTester.java 文件源码 项目:googles-monorepo-demo 阅读 17 收藏 0 点赞 0 评论 0
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);
    }
  }
}
RedstoneEtherServerAddons.java 文件源码 项目:WirelessRedstone 阅读 20 收藏 0 点赞 0 评论 0
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);
        }
    }
}
RequestContext.java 文件源码 项目:openjdk-jdk10 阅读 25 收藏 0 点赞 0 评论 0
@SuppressWarnings("unchecked")
private void mergeRequestHeaders(Packet packet) {
    //for bug 12883765
    //retrieve headers which is set in soap message
    Headers packetHeaders = (Headers) packet.invocationProperties.get(HTTP_REQUEST_HEADERS);
    //retrieve headers from request context
    Map<String, List<String>> myHeaders = (Map<String, List<String>>) asMap().get(HTTP_REQUEST_HEADERS);
    if ((packetHeaders != null) && (myHeaders != null)) {
        //update the headers set in soap message with those in request context
        for (Entry<String, List<String>> entry : myHeaders.entrySet()) {
            String key = entry.getKey();
            if (key != null && key.trim().length() != 0) {
                List<String> listFromPacket = packetHeaders.get(key);
                //if the two headers contain the same key, combine the value
                if (listFromPacket != null) {
                    listFromPacket.addAll(entry.getValue());
                } else {
                    //add the headers  in request context to those set in soap message
                    packetHeaders.put(key, myHeaders.get(key));
                }
            }
        }
        // update headers in request context with those set in soap message since it may contain other properties..
        asMap().put(HTTP_REQUEST_HEADERS, packetHeaders);
    }
}
o.java 文件源码 项目:letv 阅读 28 收藏 0 点赞 0 评论 0
private boolean a(Map<String, Object> map) {
    if (map == null || map.isEmpty()) {
        bv.f("map is null or empty in onEvent");
        return false;
    }
    for (Entry entry : map.entrySet()) {
        if (!a((String) entry.getKey())) {
            return false;
        }
        if (entry.getValue() == null) {
            return false;
        }
        if ((entry.getValue() instanceof String) && !b(entry.getValue().toString())) {
            return false;
        }
    }
    return true;
}
NpcData.java 文件源码 项目:L2J-Global 阅读 25 收藏 0 点赞 0 评论 0
public Set<String> getClansByIds(Set<Integer> clanIds)
{
    final Set<String> result = new HashSet<>();
    if (clanIds == null)
    {
        return result;
    }
    for (Entry<String, Integer> record : _clans.entrySet())
    {
        for (int id : clanIds)
        {
            if (record.getValue() == id)
            {
                result.add(record.getKey());
            }
        }
    }
    return result;
}
Stewie.java 文件源码 项目:stewie 阅读 19 收藏 0 点赞 0 评论 0
private SwaggerDefinitions swaggerDefinitions(Definitions definitions)
{
    SwaggerDefinitions result = new SwaggerDefinitions();

    for (TypeDefinition typeDefinition : definitions)
    {
        com.mauriciotogneri.jsonschema.JsonSchema jsonSchema = new com.mauriciotogneri.jsonschema.JsonSchema(typeDefinition);
        JsonObject schema = jsonSchema.schema();

        JsonObject schemaDefinitions = schema.get("definitions").getAsJsonObject();

        for (Entry<String, JsonElement> entry : schemaDefinitions.entrySet())
        {
            result.put(entry.getKey(), entry.getValue().getAsJsonObject());
        }
    }

    return result;
}
FileProvider.java 文件源码 项目:letv 阅读 31 收藏 0 点赞 0 评论 0
public Uri getUriForFile(File file) {
    try {
        String rootPath;
        String path = file.getCanonicalPath();
        Entry<String, File> mostSpecific = null;
        for (Entry<String, File> root : this.mRoots.entrySet()) {
            rootPath = ((File) root.getValue()).getPath();
            if (path.startsWith(rootPath) && (mostSpecific == null || rootPath.length() > ((File) mostSpecific.getValue()).getPath().length())) {
                mostSpecific = root;
            }
        }
        if (mostSpecific == null) {
            throw new IllegalArgumentException("Failed to find configured root that contains " + path);
        }
        rootPath = ((File) mostSpecific.getValue()).getPath();
        if (rootPath.endsWith("/")) {
            path = path.substring(rootPath.length());
        } else {
            path = path.substring(rootPath.length() + 1);
        }
        return new Builder().scheme(WidgetRequestParam.REQ_PARAM_COMMENT_CONTENT).authority(this.mAuthority).encodedPath(Uri.encode((String) mostSpecific.getKey()) + LetvUtils.CHARACTER_BACKSLASH + Uri.encode(path, "/")).build();
    } catch (IOException e) {
        throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
    }
}
PersistentCookieStore.java 文件源码 项目:boohee_v5.6 阅读 26 收藏 0 点赞 0 评论 0
public boolean clearExpired(Date date) {
    boolean clearedAny = false;
    Editor prefsWriter = this.cookiePrefs.edit();
    for (Entry<String, Cookie> entry : this.cookies.entrySet()) {
        String name = (String) entry.getKey();
        if (((Cookie) entry.getValue()).isExpired(date)) {
            this.cookies.remove(name);
            prefsWriter.remove(COOKIE_NAME_PREFIX + name);
            clearedAny = true;
        }
    }
    if (clearedAny) {
        prefsWriter.putString(COOKIE_NAME_STORE, TextUtils.join(",", this.cookies.keySet()));
    }
    prefsWriter.commit();
    return clearedAny;
}
FingerPrint.java 文件源码 项目:Babler 阅读 22 收藏 0 点赞 0 评论 0
/**
 * reads a FingerPrint from the passed InputStream
 * 
 * @param is
 *            InputStream to be read
 */
private void loadFingerPrintFromInputStream(InputStream is) {
    entries = new TreeSet<Entry<String, Integer>>(
            new NGramEntryComparator());
    MyProperties properties = new MyProperties();
    properties.load(is);
    for (Entry<String, String> entry : properties.entrySet()) {
        try {
            this.put(entry.getValue(), Integer.parseInt(entry.getKey()));
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
    entries.addAll(this.entrySet());
}
CopyOnWriteArrayMap.java 文件源码 项目:myfaces-trinidad 阅读 27 收藏 0 点赞 0 评论 0
@Override
public boolean equals(Object o)
{
  if (o == this)
    return true;

  if (o instanceof Entry)
  {
    Entry otherEntry = (Entry)o;

    if (getKey().equals(otherEntry.getKey()))
    {
      Object otherValue = otherEntry.getValue();
      V value = _value;

      return (value != null) ? value.equals(otherValue) : otherValue == null;
    }
  }

  return false;
}
NavMeshVertex.java 文件源码 项目:Pogamut3 阅读 23 收藏 0 点赞 0 评论 0
public NavMeshVertex(
        final int id,
        Location location,
        final Map<Integer,Integer> polygonIdToVertexIndexMap,
        final List<Integer> edgeIds,
        boolean isOnWalkableAreaEdge,
        final NodeConstructionCoordinator constructionCoordinator
) {
    this.id = id;
    this.location = location;
    this.isOnWalkableAreaEdge = isOnWalkableAreaEdge;
    initializeConstCollections();

    constructionCoordinator.addDeferredConstructor(
        new IDeferredConstructor() {
            @Override
            public void construct() {
                for ( Entry<Integer, Integer> entry : polygonIdToVertexIndexMap.entrySet() ) {
                    polygonToVertexIndexMap.put(
                        constructionCoordinator.getPolygonById( entry.getKey() ),
                        entry.getValue()
                    );
                }

                for ( Integer edgeId : edgeIds ) {
                    edges.add( constructionCoordinator.getEdgeById(edgeId) );
                }
            }
        }
    );
}
HStoreConf.java 文件源码 项目:s-store 阅读 21 收藏 0 点赞 0 评论 0
private void setDefaultValues() {
    // Set the default values for the parameters based on their annotations
    for (Entry<Field, ConfigProperty> e : this.getConfigProperties().entrySet()) {
        Field f = e.getKey();
        ConfigProperty cp = e.getValue();
        Object value = getDefaultValue(f, cp);

        try {
            if (value != null) f.set(this, value);
        } catch (Exception ex) {
            throw new RuntimeException(String.format("Failed to set default value '%s' for field '%s'", value, f.getName()), ex);
        }
        if (trace.val) LOG.trace(String.format("%-20s = %s", f.getName(), value));
    } // FOR   
}
SuccessfullyEmbeddingPartitionsNodesRatio.java 文件源码 项目:alevin-svn2 阅读 21 收藏 0 点赞 0 评论 0
public double calculate(NetworkStack stack) {
    double sumSNodes = 0;

    Map<ClusterHead, List<VirtualNetwork>> map = counter.numberOfVNRsSuccessfullyEmbeddedPerPartition;

    for (Entry<ClusterHead, List<VirtualNetwork>> e : map.entrySet()) {
        sumSNodes += ((((double) e.getKey().cluster.getVertexCount()) * 100.0d)
                / (double) stack.getSubstrate().getVertexCount())
                * (double) e.getValue().size();
    }

    double result = (sumSNodes / ((double) (stack.size() - 1)));
    return result;
}
XmlPolicyModelMarshaller.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Write default prefixes onto the given TypedXmlWriter
 *
 * @param model The policy source model. May not be null.
 * @param writer The TypedXmlWriter. May not be null.
 * @throws PolicyException If the creation of the prefix to namespace URI map failed.
 */
private void marshalDefaultPrefixes(final PolicySourceModel model, final TypedXmlWriter writer) throws PolicyException {
    final Map<String, String> nsMap = model.getNamespaceToPrefixMapping();
    if (!marshallInvisible && nsMap.containsKey(PolicyConstants.SUN_POLICY_NAMESPACE_URI)) {
        nsMap.remove(PolicyConstants.SUN_POLICY_NAMESPACE_URI);
    }
    for (Map.Entry<String, String> nsMappingEntry : nsMap.entrySet()) {
        writer._namespace(nsMappingEntry.getKey(), nsMappingEntry.getValue());
    }
}
MapEntrySetTester.java 文件源码 项目:guava-mock 阅读 25 收藏 0 点赞 0 评论 0
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testSetValue() {
  for (Entry<K, V> entry : getMap().entrySet()) {
    if (entry.getKey().equals(k0())) {
      assertEquals("entry.setValue() should return the old value", v0(), entry.setValue(v3()));
      break;
    }
  }
  expectReplacement(entry(k0(), v3()));
}
JiraUpdateDao.java 文件源码 项目:plugin-bt-jira 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Associate custom field values to a given issue.
 */
@SuppressWarnings("unchecked")
private int associateCutomFieldValues(final Map<String, CustomFieldEditor> customFields,
        final JdbcOperations jdbcTemplate, final int nextId, final JiraIssueRow issueRow) {
    int nextIdl = nextId;
    for (final Entry<String, Object> entry : issueRow.getCustomFields().entrySet()) {
        final String cfName = entry.getKey();
        final CustomField customField = customFields.get(cfName);
        final int cfId = customField.getId();
        final Object cfValue = entry.getValue();

        // Determine the right 'customfieldvalue' column
        final String column = JiraDao.MANAGED_TYPE.get(customField.getFieldType()).getCustomColumn();
        final Collection<Object> values;
        if (cfValue instanceof Collection) {
            // Multi-values
            values = (Collection<Object>) cfValue;
        } else {
            // Single value
            values = new ArrayList<>(1);
            values.add(cfValue);
        }
        nextIdl = associateCustomFieldValue(jdbcTemplate, issueRow.getId(), nextIdl, cfId, column, values);

    }
    return nextIdl;
}


问题


面经


文章

微信
公众号

扫码关注公众号