org.json.simple.JSONArray#forEach ( )源码实例Demo

下面列出了org.json.simple.JSONArray#forEach ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: java-mojang-api   文件: Mojang.java
/**
 * Retrieves all the username a certain UUID has had in the past, including the current one.
 *
 * @param uuid the UUID
 *
 * @return a map with the username as key value and the Timestamp as a {@link java.lang.Long Long}
 */
public Map<String, Long> getNameHistoryOfPlayer(String uuid)
{
    JSONArray         arr     = getJSONArray("https://api.mojang.com/user/profiles/" + uuid + "/names");
    Map<String, Long> history = new HashMap<>();
    arr.forEach(o ->
    {
        JSONObject obj = (JSONObject) o;
        history.put((String) obj.get("name"), obj.get("changedToAt") == null ? 0 : Long.parseLong(obj.get("changedToAt").toString()));
    });
    return history;
}
 
源代码2 项目: daq   文件: EntryPoint.java
private static void addBacnetProperties(JSONArray bacnetObjectsList) {
    bacnetObjectsList.forEach(bacnetObject -> addProperty((JSONObject) bacnetObject));
}
 
源代码3 项目: daq   文件: EntryPoint.java
private static void getDeviceID(JSONArray bacnetObjectsList) {
    bacnetObjectsList.forEach(bacnetObject -> getID((JSONObject) bacnetObject));
}
 
/**
 * Parses the audit proof retrieved from Log.
 *
 * @param proof An array of base64-encoded Merkle Tree nodes proving the inclusion of the chosen
 *     certificate.
 * @param leafIndex The index of the desired entry.
 * @param treeSize The tree size of the tree for which the proof is desired.
 * @return {@link MerkleAuditProof}
 */
public static MerkleAuditProof parseAuditProof(JSONArray proof, long leafIndex, long treeSize) {

  MerkleAuditProof audit_proof = new MerkleAuditProof(Ct.Version.V1, treeSize, leafIndex);
  proof.forEach(node -> audit_proof.pathNode.add(Base64.decodeBase64((String) node)));
  return audit_proof;
}