File tree 2 files changed +30
-20
lines changed
metrics/src/main/java/com/google/gson/metrics
2 files changed +30
-20
lines changed Original file line number Diff line number Diff line change @@ -64,16 +64,21 @@ public void timeBagOfPrimitivesStreaming(int reps) throws IOException {
64
64
String stringValue = null ;
65
65
while (jr .hasNext ()) {
66
66
String name = jr .nextName ();
67
- if (name .equals ("longValue" )) {
68
- longValue = jr .nextLong ();
69
- } else if (name .equals ("intValue" )) {
70
- intValue = jr .nextInt ();
71
- } else if (name .equals ("booleanValue" )) {
72
- booleanValue = jr .nextBoolean ();
73
- } else if (name .equals ("stringValue" )) {
74
- stringValue = jr .nextString ();
75
- } else {
76
- throw new IOException ("Unexpected name: " + name );
67
+ switch (name ) {
68
+ case "longValue" :
69
+ longValue = jr .nextLong ();
70
+ break ;
71
+ case "intValue" :
72
+ intValue = jr .nextInt ();
73
+ break ;
74
+ case "booleanValue" :
75
+ booleanValue = jr .nextBoolean ();
76
+ break ;
77
+ case "stringValue" :
78
+ stringValue = jr .nextString ();
79
+ break ;
80
+ default :
81
+ throw new IOException ("Unexpected name: " + name );
77
82
}
78
83
}
79
84
jr .endObject ();
Original file line number Diff line number Diff line change @@ -76,16 +76,21 @@ public void timeCollectionsStreaming(int reps) throws IOException {
76
76
String stringValue = null ;
77
77
while (jr .hasNext ()) {
78
78
String name = jr .nextName ();
79
- if (name .equals ("longValue" )) {
80
- longValue = jr .nextLong ();
81
- } else if (name .equals ("intValue" )) {
82
- intValue = jr .nextInt ();
83
- } else if (name .equals ("booleanValue" )) {
84
- booleanValue = jr .nextBoolean ();
85
- } else if (name .equals ("stringValue" )) {
86
- stringValue = jr .nextString ();
87
- } else {
88
- throw new IOException ("Unexpected name: " + name );
79
+ switch (name ) {
80
+ case "longValue" :
81
+ longValue = jr .nextLong ();
82
+ break ;
83
+ case "intValue" :
84
+ intValue = jr .nextInt ();
85
+ break ;
86
+ case "booleanValue" :
87
+ booleanValue = jr .nextBoolean ();
88
+ break ;
89
+ case "stringValue" :
90
+ stringValue = jr .nextString ();
91
+ break ;
92
+ default :
93
+ throw new IOException ("Unexpected name: " + name );
89
94
}
90
95
}
91
96
jr .endObject ();
You can’t perform that action at this time.
0 commit comments