Determine if the JSONObject contains a specific key.
Parameters:
key A key string.
Returns:
true if the key exists in the JSONObject.
public boolean has(String key) {
return this.map.containsKey(key);
}
public JSONObject() {
this.map = new HashMap<String, Object>();
}
On peut voir que le jugement est effectué en utilisant la méthode Map.containsKey(key).
On peut voir que le jugement est effectué en utilisant la méthode Map.containsKey(key).
Déterminer s'il y a un certain champ dans la classe
Requête si l'objet contient la clé et renvoie un booléen, ce qui est cohérent avec l'utilisation de Map.containsKey(key)