- Common ways to obtain JSONArray
private void myMethod () {JSONArray j =
new JSONArray()
JSONObject json;Object object;(JSONArray) json.get(object)
String s;(JSONArray) JSONValue.parse(s)
- Smart code suggestions by Codota
}
public JSONArray storeRecentSearch( String recentSearch ) { JSONArray recentSearches = getRecentSearches(); try { if ( recentSearch == null || recentSearches.contains( recentSearch ) ) { return recentSearches; } recentSearches.add( recentSearch ); if ( recentSearches.size() > 5 ) { recentSearches.remove( 0 ); } PropsUI props = PropsUI.getInstance(); String jsonValue = props.getRecentSearches(); JSONParser jsonParser = new JSONParser(); JSONObject jsonObject = jsonValue != null ? (JSONObject) jsonParser.parse( jsonValue ) : new JSONObject(); jsonObject.put( getLogin(), recentSearches ); props.setRecentSearches( jsonObject.toJSONString() ); } catch ( Exception e ) { e.printStackTrace(); } return recentSearches; }
if(u.containsValue(key)) { System.out.println("NEucaCometDataGenerator::remove: Removed object with key " + key + " from " + family.toString()); familyToBeUpdated.remove(i); retVal = true; break;