2828import java .math .BigDecimal ;
2929import java .math .BigInteger ;
3030import java .util .Collection ;
31+ import java .util .Collections ;
3132import java .util .Date ;
3233import java .util .HashMap ;
3334import java .util .Iterator ;
@@ -272,7 +273,8 @@ private VPack(final Map<Type, VPackSerializer<?>> serializers,
272273 @ Override
273274 public void serialize (final VPackBuilder builder , final String attribute , final Object entity )
274275 throws VPackParserException {
275- VPack .this .serialize (attribute , entity , entity .getClass (), builder , new HashMap <String , Object >());
276+ VPack .this .serialize (attribute , entity , entity .getClass (), builder ,
277+ Collections .<String , Object > emptyMap ());
276278 }
277279 };
278280 deserializationContext = new VPackDeserializationContext () {
@@ -496,7 +498,7 @@ private <T, K, C> Object deserializeMap(
496498 }
497499
498500 public VPackSlice serialize (final Object entity ) throws VPackParserException {
499- return serialize (entity , entity .getClass (), new HashMap <String , Object >());
501+ return serialize (entity , entity .getClass (), Collections . <String , Object > emptyMap ());
500502 }
501503
502504 public VPackSlice serialize (final Object entity , final Map <String , Object > additionalFields )
@@ -505,7 +507,7 @@ public VPackSlice serialize(final Object entity, final Map<String, Object> addit
505507 }
506508
507509 public VPackSlice serialize (final Object entity , final Type type ) throws VPackParserException {
508- return serialize (entity , type , new HashMap <String , Object >());
510+ return serialize (entity , type , Collections . <String , Object > emptyMap ());
509511 }
510512
511513 public VPackSlice serialize (final Object entity , final Type type , final Map <String , Object > additionalFields )
@@ -561,15 +563,15 @@ private void serializeFields(
561563 final Map <String , FieldInfo > fields = cache .getFields (entity .getClass ());
562564 for (final FieldInfo fieldInfo : fields .values ()) {
563565 if (fieldInfo .isSerialize ()) {
564- serializeField (entity , builder , fieldInfo , new HashMap <String , Object >());
566+ serializeField (entity , builder , fieldInfo , Collections . <String , Object > emptyMap ());
565567 }
566568 }
567569 for (final Entry <String , Object > entry : additionalFields .entrySet ()) {
568570 final String key = entry .getKey ();
569571 if (!fields .containsKey (key )) {
570572 final Object value = entry .getValue ();
571573 addValue (key , value != null ? value .getClass () : null , value , builder , null ,
572- new HashMap <String , Object >());
574+ Collections . <String , Object > emptyMap ());
573575 }
574576 }
575577 }
@@ -623,7 +625,7 @@ private void addValue(
623625 } else if (((Class ) type ).isEnum ()) {
624626 builder .add (name , Enum .class .cast (value ).name ());
625627 } else if (((Class ) type ) != value .getClass ()) {
626- addValue (name , value .getClass (), value , builder , fieldInfo , new HashMap <String , Object >());
628+ addValue (name , value .getClass (), value , builder , fieldInfo , Collections . <String , Object > emptyMap ());
627629 } else {
628630 serializeObject (name , value , builder , additionalFields );
629631 }
@@ -636,7 +638,7 @@ private void serializeArray(final String name, final Object value, final VPackBu
636638 for (int i = 0 ; i < Array .getLength (value ); i ++) {
637639 final Object element = Array .get (value , i );
638640 if (element != null ) {
639- addValue (null , element .getClass (), element , builder , null , new HashMap <String , Object >());
641+ addValue (null , element .getClass (), element , builder , null , Collections . <String , Object > emptyMap ());
640642 } else {
641643 builder .add (ValueType .NULL );
642644 }
@@ -650,7 +652,7 @@ private void serializeIterable(final String name, final Object value, final VPac
650652 for (final Iterator iterator = Iterable .class .cast (value ).iterator (); iterator .hasNext ();) {
651653 final Object element = iterator .next ();
652654 addValue (null , element != null ? element .getClass () : null , element , builder , null ,
653- new HashMap <String , Object >());
655+ Collections . <String , Object > emptyMap ());
654656 }
655657 builder .close ();
656658 }
@@ -672,14 +674,14 @@ private void serializeMap(
672674 final Object entryValue = entry .getValue ();
673675 addValue (keyMapAdapter .serialize (entry .getKey ()),
674676 entryValue != null ? entryValue .getClass () : Object .class , entry .getValue (), builder , null ,
675- new HashMap <String , Object >());
677+ Collections . <String , Object > emptyMap ());
676678 }
677679 for (final Entry <String , Object > entry : additionalFields .entrySet ()) {
678680 final String key = entry .getKey ();
679681 if (!map .containsKey (key )) {
680682 final Object additionalValue = entry .getValue ();
681683 addValue (key , additionalValue != null ? additionalValue .getClass () : null , additionalValue ,
682- builder , null , new HashMap <String , Object >());
684+ builder , null , Collections . <String , Object > emptyMap ());
683685 }
684686 }
685687 additionalFields .clear ();
@@ -691,9 +693,9 @@ private void serializeMap(
691693 final String s = null ;
692694 builder .add (s , ValueType .OBJECT );
693695 addValue (ATTR_KEY , entry .getKey ().getClass (), entry .getKey (), builder , null ,
694- new HashMap <String , Object >());
696+ Collections . <String , Object > emptyMap ());
695697 addValue (ATTR_VALUE , entry .getValue ().getClass (), entry .getValue (), builder , null ,
696- new HashMap <String , Object >());
698+ Collections . <String , Object > emptyMap ());
697699 builder .close ();
698700 }
699701 builder .close ();
0 commit comments