Github user gauravgopi123 commented on a diff in the pull request:
https://github.com/apache/incubator-apex-malhar/pull/91#discussion_r44212068
--- Diff:
library/src/main/java/com/datatorrent/lib/appdata/schemas/SchemaUtils.java ---
@@ -490,5 +493,54 @@ public static JSONObject createJSONObject(Map<String,
String> map)
return jo;
}
+ /**
+ * This is a helper method which converts the given {@link JSONArray} to
a {@link List} of Strings.
+ *
+ * @param jsonStringArray The {@link JSONArray} to convert.
+ * @return The converted {@link List} of Strings.
+ */
+ public static List<String> getStringsFromJSONArray(JSONArray
jsonStringArray) throws JSONException
+ {
+ List<String> stringArray = Lists.newArrayList();
+
+ for (int stringIndex = 0; stringIndex < jsonStringArray.length();
stringIndex++) {
+ stringArray.add(jsonStringArray.getString(stringIndex));
+ }
+
+ return stringArray;
+ }
+
+ /**
+ * This is a helper method which converts a list of strings to a {@link
JSONArray}.
+ *
+ * @param stringArray The list of strings to convert to a {@link
JSONArray}.
+ * @return The converted {@link JSONArray}.
+ */
+ public static JSONArray getJSONArrayFromStrings(List<String> stringArray)
+ {
+ JSONArray ja = new JSONArray();
--- End diff --
JSONArray(Collection collection) ??
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---