private static Set < Node > newNodes ( Model mo , JSONObject o , String key ) throws JSONConverterException { checkKeys ( o , key ) ; Object x = o . get ( key ) ; if ( ! ( x instanceof JSONArray ) ) { throw new JSONConverterException ( "array expected at key '" + key + "'" ) ; } Set < Node > s = new HashSet <> ( ( ( JSONArray ) x ) . size ( ) ) ; for ( Object i : ( JSONArray ) x ) { int id = ( Integer ) i ; Node n = mo . newNode ( id ) ; if ( n == null ) { throw JSONConverterException . nodeAlreadyDeclared ( id ) ; } s . add ( n ) ; } return s ; }
Build nodes from a key .