Get the double value associated with an index. @param index must be between 0 and length() - 1 @return The value. @throws RuntimeException If the key is not found or if the value cannot be converted to a number.
(int index)
| 424 | * be converted to a number. |
| 425 | */ |
| 426 | public double getDouble(int index) { |
| 427 | Object object = this.get(index); |
| 428 | try { |
| 429 | return object instanceof Number |
| 430 | ? ((Number)object).doubleValue() |
| 431 | : Double.parseDouble((String)object); |
| 432 | } catch (Exception e) { |
| 433 | throw new RuntimeException("JSONArray[" + index + "] is not a number."); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | |
| 438 | /** |
no test coverage detected