Skip to content
This repository has been archived by the owner on Jun 16, 2019. It is now read-only.

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan Follestad authored and Aidan Follestad committed Mar 9, 2017
1 parent 5781050 commit fc83da0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.afollestad'
version '1.4.12'
version '1.4.13'

apply plugin: 'java'
apply plugin: 'idea'
Expand Down Expand Up @@ -34,7 +34,7 @@ publish {
userOrg = 'drummer-aidan'
groupId = 'com.afollestad'
artifactId = 'ason'
publishVersion = '1.4.12'
publishVersion = '1.4.13'
website = 'https://github.com/afollestad/ason'
}

Expand Down
23 changes: 14 additions & 9 deletions src/main/java/com/afollestad/ason/AsonArray.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package com.afollestad.ason;

import static com.afollestad.ason.Util.getPathValue;
import static com.afollestad.ason.Util.isList;
import static com.afollestad.ason.Util.isNull;
import static com.afollestad.ason.Util.isPrimitive;
import static com.afollestad.ason.Util.splitPath;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import static com.afollestad.ason.Util.*;

/** @author Aidan Follestad (afollestad) */
/**
* @author Aidan Follestad (afollestad)
*/
@SuppressWarnings({"unchecked", "WeakerAccess", "unused", "SameParameterValue"})
public class AsonArray<T> implements Iterable<T> {

Expand Down Expand Up @@ -136,15 +141,15 @@ public Ason getJsonObject(int index) {
}

@Nullable
public AsonArray getJsonArray(int index) {
public <IT> AsonArray<IT> getJsonArray(int index) {
if (index < 0 || index > array.length() - 1) {
throw new IndexOutOfBoundsException("Index " + index + " is out of bounds for this array!");
}
JSONArray ary = array.optJSONArray(index);
if (Util.isNull(ary)) {
return null;
}
return new AsonArray(ary);
return new AsonArray<>(ary);
}

Object getInternal(int index, @Nullable String path) {
Expand Down

0 comments on commit fc83da0

Please sign in to comment.