public static void writeJSONString(Collection collection,Writer out) throws IOException {
  if (collection == null) {
    out.write("null");
    return;
  }
  boolean first=true;
  Iterator iter=collection.iterator();
  out.write('[');
  while (iter.hasNext()) {
    if (first)     first=false;
 else     out.write(',');
    Object value=iter.next();
    if (value == null) {
      out.write("null");
      continue;
    }
    JSONValue.writeJSONString(value,out);
  }
  out.write(']');
}

public static void writeJSONString ( Collection collection , Writer out ) throws IOException { if ( collection == null ) { out . write ( "null" ) ; return ; } boolean first = true ; Iterator iter = collection . iterator ( ) ; out . write ( '[' ) ; while ( iter . hasNext ( ) ) { if ( first ) first = false ; else out . write ( ',' ) ; Object value = iter . next ( ) ; if ( value == null ) { out . write ( "null" ) ; continue ; } JSONValue . writeJSONString ( value , out ) ; } out . write ( ']' ) ; }
encode a list into json text and write it to out . if this list is also a jsonstreamaware or a jsonaware , jsonstreamaware and jsonaware specific behaviours will be ignored at this top level .
