Skip to content

Commit cef63eb

Browse files
scotthernandezerh
authored andcommitted
more general support for Iterable in JSON.serialize - JAVA-161
1 parent e87dabe commit cef63eb

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/main/com/mongodb/util/JSON.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
package com.mongodb.util;
44

5-
import com.mongodb.*;
6-
import org.bson.*;
7-
import org.bson.types.*;
8-
95
import java.text.*;
106
import java.util.*;
117
import java.util.regex.*;
128

9+
import org.bson.*;
10+
import org.bson.types.*;
11+
12+
import com.mongodb.*;
13+
1314
/**
1415
* Helper methods for JSON serialization and de-serialization
1516
*/
@@ -69,12 +70,12 @@ public static void serialize( Object o , StringBuilder buf ){
6970
return;
7071
}
7172

72-
if ( o instanceof Collection){
73+
if ( o instanceof Iterable){
7374

7475
boolean first = true;
7576
buf.append( "[ " );
7677

77-
for ( Object n : (Collection)o ){
78+
for ( Object n : (Iterable)o ){
7879
if ( first ) first = false;
7980
else buf.append( " , " );
8081

0 commit comments

Comments
 (0)