question: private Set < Emoticon > parseEmoticons ( String json ) { Set < Emoticon > result = new HashSet < > ( ) ; if ( json == null ) { return null ; } JSONParser parser = new JSONParser ( ) ; int errors = 0 ; try { JSONObject root = ( JSONObject ) parser . parse ( json ) ; JSONArray emoticons = ( JSONArray ) root . get ( "emoticons" ) ; for ( Object obj : emoticons ) { if ( obj instanceof JSONObject ) { JSONObject emote_json = ( JSONObject ) obj ; Emoticon emote = parseEmoticon ( emote_json ) ; if ( emote == null ) { if ( errors < 10 ) { LOGGER . warning ( "Error loading emote: " + emote_json ) ; } errors ++ ; } else { result . add ( emote ) ; } } } if ( errors > 0 ) { LOGGER . warning ( errors + " emotes couldn't be loaded" ) ; } if ( errors > 100 ) { return null ; } return result ; } catch ( ParseException | NullPointerException | ClassCastException ex ) { LOGGER . warning ( "Error parsing emoticons: " + ex ) ; return null ; } }
target:  Parses the list of emoticons from the Twitch API.