@@ -35,6 +35,8 @@ Linked Data Benchmark Council (http://www.ldbcouncil.org)
35
35
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/
36
36
package ldbc .snb .datagen .serializer ;
37
37
38
+ import com .google .common .base .Joiner ;
39
+ import com .google .common .collect .Iterables ;
38
40
import ldbc .snb .datagen .dictionary .Dictionaries ;
39
41
import ldbc .snb .datagen .entities .dynamic .relations .Knows ;
40
42
import ldbc .snb .datagen .entities .dynamic .person .Person ;
@@ -88,26 +90,11 @@ public String getGender(int gender) {
88
90
}
89
91
}
90
92
public String buildLanguages (ArrayList <Integer > languages ) {
91
- StringBuilder languagesBuilder = new StringBuilder ();
92
- for (int i = 0 ; i < languages .size ()-1 ; i ++) {
93
- languagesBuilder .append (Dictionaries .languages .getLanguageName (languages .get (i ))+";" );
94
- }
95
- if (languages .size () > 0 ) {
96
- languagesBuilder .append (Dictionaries .languages .getLanguageName (languages .get (languages .size ()-1 )));
97
- }
98
- return languagesBuilder .toString ();
93
+ return Joiner .on (";" ).join (languages );
99
94
}
100
95
101
96
public String buildEmail (TreeSet <String > emails ) {
102
- StringBuilder emailsBuilder = new StringBuilder ();
103
- Iterator <String > itString = emails .iterator ();
104
- for (int i = 0 ; i < emails .size ()-1 ; i ++) {
105
- emailsBuilder .append (itString .next ()+";" );
106
- }
107
- if (itString .hasNext ()) {
108
- emailsBuilder .append (itString .next ());
109
- }
110
- return emailsBuilder .toString ();
97
+ return Joiner .on (";" ).join (emails );
111
98
}
112
99
113
100
abstract protected void serialize (final Person p );
0 commit comments