diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 6979ab3..1014e65 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ 4.0.0 tw.kane osu4j - v1.1.3 + v1.1.4 @@ -23,7 +23,7 @@ github - osu!4J - The osu API client written in Java + osu!4J - The osu API wrapper written in Java https://maven.pkg.github.com/Gary50613/osu4j diff --git a/pom.xml b/pom.xml index f797d66..73a4cf6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ tw.kane osu4j - v1.1.3 + v1.1.4 github - osu!4J - The osu API client written in Java + osu!4J - The osu API wrapper written in Java https://maven.pkg.github.com/Gary50613/osu4j diff --git a/src/main/java/tw/kane/osu4j/OsuClient.java b/src/main/java/tw/kane/osu4j/OsuClient.java index ca083f3..2d50fd7 100644 --- a/src/main/java/tw/kane/osu4j/OsuClient.java +++ b/src/main/java/tw/kane/osu4j/OsuClient.java @@ -9,6 +9,7 @@ import tw.kane.osu4j.Exception.NotFoundException; import java.io.IOException; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -75,10 +76,10 @@ public Score[] getUserRecent(String id) throws IOException, InvalidTokenExceptio JSONArray resultArray = new JSONArray(responseString); if(resultArray.length() == 0) throw new NotFoundException(); - List scores = new LinkedList<>(); - resultArray.toList().forEach(score -> - scores.add(new Score((JSONObject) score)) - ); + List scores = new ArrayList<>(); + for (int i = 0; i < resultArray.length(); i++) { + scores.add(new Score(resultArray.getJSONObject(i))); + } return scores.toArray(scores.toArray(new Score[scores.size()])); } return null; @@ -109,10 +110,10 @@ public Score[] getUserBest(String id) throws IOException, InvalidTokenException, JSONArray resultArray = new JSONArray(responseString); if(resultArray.length() == 0) throw new NotFoundException(); - List scores = new LinkedList<>(); - resultArray.toList().forEach(score -> - scores.add(new Score((JSONObject) score)) - ); + List scores = new ArrayList<>(); + for (int i = 0; i < resultArray.length(); i++) { + scores.add(new Score(resultArray.getJSONObject(i))); + } return scores.toArray(scores.toArray(new Score[scores.size()])); } return null;