mirror of
https://github.com/stleary/JSON-java.git
synced 2026-04-30 00:00:45 -04:00
optString
This commit is contained in:
Executable → Regular
+3
-3
@@ -76,7 +76,7 @@ import java.util.Map;
|
||||
* </ul>
|
||||
|
||||
* @author JSON.org
|
||||
* @version 2011-11-24
|
||||
* @version 2011-12-19
|
||||
*/
|
||||
public class JSONArray {
|
||||
|
||||
@@ -555,8 +555,8 @@ public class JSONArray {
|
||||
public String optString(int index, String defaultValue) {
|
||||
Object object = this.opt(index);
|
||||
return JSONObject.NULL.equals(object)
|
||||
? object.toString()
|
||||
: defaultValue;
|
||||
? defaultValue
|
||||
: object.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user