Skip to content

Commit

Permalink
Make list Immutable instead of synchronized
Browse files Browse the repository at this point in the history
  • Loading branch information
meriouma committed Oct 21, 2015
1 parent 013de36 commit 7becf62
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import com.google.common.collect.Lists;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
Expand All @@ -38,9 +37,8 @@ public class GsonDateTypeAdapter implements JsonDeserializer<Date> {
"yyyy-MM-dd'T'HH:mm:ss.SSSSSSXXX");
private static final DateFormat CUSTOM_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssXXX");
private static final List<DateFormat> dateFormats =
Collections.synchronizedList(Lists.newArrayList(
DATE_TIME_LONG_FORMAT_ALT2, DATE_TIME_LONG_FORMAT, DATE_TIME_FORMAT,
CUSTOM_DATE_FORMAT, DATE_TIME_LONG_FORMAT_ALT));
ImmutableList.of(DATE_TIME_LONG_FORMAT_ALT2, DATE_TIME_LONG_FORMAT, DATE_TIME_FORMAT,
CUSTOM_DATE_FORMAT, DATE_TIME_LONG_FORMAT_ALT);

@Override
public Date deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException {
Expand Down

0 comments on commit 7becf62

Please sign in to comment.