reduce object creation during JSON serialization (#2576)
If a new {@code Double} instance is not required, this method * should generally be used in preference to the constructor * {@link #Double(double)}, as this method is likely to yield * significantly better space and time performance by caching * frequently requested values.
This commit is contained in:
parent
26232d8507
commit
15710ace17
@ -109,7 +109,7 @@ public class SerializationFilters {
|
|||||||
@Override
|
@Override
|
||||||
public void serialize(Double arg0, JsonGenerator gen, SerializerProvider s)
|
public void serialize(Double arg0, JsonGenerator gen, SerializerProvider s)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (new Double(arg0.longValue()).equals(arg0)) {
|
if (Double.valueOf(arg0.longValue()).equals(arg0)) {
|
||||||
gen.writeNumber(arg0.longValue());
|
gen.writeNumber(arg0.longValue());
|
||||||
} else {
|
} else {
|
||||||
gen.writeNumber(arg0);
|
gen.writeNumber(arg0);
|
||||||
|
Loading…
Reference in New Issue
Block a user