Polish: Maps with keys that are enum values should be replaced with EnumMap
This commit is contained in:
parent
9a6fbf59c5
commit
d3a1d44864
|
@ -21,7 +21,7 @@ import java.text.ParseException;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
@ -48,7 +48,7 @@ public class DateFormatter implements Formatter<Date> {
|
|||
private static final Map<ISO, String> ISO_PATTERNS;
|
||||
|
||||
static {
|
||||
Map<ISO, String> formats = new HashMap<>(4);
|
||||
Map<ISO, String> formats = new EnumMap<>(ISO.class);
|
||||
formats.put(ISO.DATE, "yyyy-MM-dd");
|
||||
formats.put(ISO.TIME, "HH:mm:ss.SSSXXX");
|
||||
formats.put(ISO.DATE_TIME, "yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.springframework.format.datetime.joda;
|
|||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
|
@ -64,7 +64,7 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
|
|||
/**
|
||||
* User defined formatters.
|
||||
*/
|
||||
private final Map<Type, DateTimeFormatter> formatters = new HashMap<>();
|
||||
private final Map<Type, DateTimeFormatter> formatters = new EnumMap<>(Type.class);
|
||||
|
||||
/**
|
||||
* Factories used when specific formatters have not been specified.
|
||||
|
@ -73,7 +73,7 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
|
|||
|
||||
|
||||
public JodaTimeFormatterRegistrar() {
|
||||
this.factories = new HashMap<>();
|
||||
this.factories = new EnumMap<>(Type.class);
|
||||
for (Type type : Type.values()) {
|
||||
this.factories.put(type, new DateTimeFormatterFactory());
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -67,7 +68,7 @@ public class TransportHandlingSockJsService extends AbstractSockJsService implem
|
|||
"com.fasterxml.jackson.databind.ObjectMapper", TransportHandlingSockJsService.class.getClassLoader());
|
||||
|
||||
|
||||
private final Map<TransportType, TransportHandler> handlers = new HashMap<>();
|
||||
private final Map<TransportType, TransportHandler> handlers = new EnumMap<>(TransportType.class);
|
||||
|
||||
@Nullable
|
||||
private SockJsMessageCodec messageCodec;
|
||||
|
|
Loading…
Reference in New Issue