Polishing

(cherry picked from commit b541fc9)
This commit is contained in:
Juergen Hoeller
2015-03-06 18:50:49 +01:00
parent f01a0303f1
commit 7ed7f981c9
14 changed files with 90 additions and 94 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -335,9 +335,10 @@ public abstract class CollectionUtils {
}
/**
* Adapt a {@code Map<K, List<V>>} to an {@code MultiValueMap<K,V>}.
* @param map the map
* Adapt a {@code Map<K, List<V>>} to an {@code MultiValueMap<K, V>}.
* @param map the original map
* @return the multi-value map
* @since 3.1
*/
public static <K, V> MultiValueMap<K, V> toMultiValueMap(Map<K, List<V>> map) {
return new MultiValueMapAdapter<K, V>(map);
@@ -348,8 +349,9 @@ public abstract class CollectionUtils {
* Return an unmodifiable view of the specified multi-value map.
* @param map the map for which an unmodifiable view is to be returned.
* @return an unmodifiable view of the specified multi-value map.
* @since 3.1
*/
public static <K,V> MultiValueMap<K,V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {
public static <K, V> MultiValueMap<K, V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {
Assert.notNull(map, "'map' must not be null");
Map<K, List<V>> result = new LinkedHashMap<K, List<V>>(map.size());
for (Map.Entry<? extends K, ? extends List<? extends V>> entry : map.entrySet()) {
@@ -366,7 +368,7 @@ public abstract class CollectionUtils {
*/
private static class EnumerationIterator<E> implements Iterator<E> {
private Enumeration<E> enumeration;
private final Enumeration<E> enumeration;
public EnumerationIterator(Enumeration<E> enumeration) {
this.enumeration = enumeration;
@@ -476,8 +478,8 @@ public abstract class CollectionUtils {
}
@Override
public void putAll(Map<? extends K, ? extends List<V>> m) {
this.map.putAll(m);
public void putAll(Map<? extends K, ? extends List<V>> map) {
this.map.putAll(map);
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ public class ByteBufferConverterTests {
private GenericConversionService conversionService;
@Before
public void setup() {
this.conversionService = new GenericConversionService();
@@ -43,6 +44,7 @@ public class ByteBufferConverterTests {
this.conversionService.addConverter(new OtherTypeToByteArrayConverter());
}
@Test
public void byteArrayToByteBuffer() throws Exception {
byte[] bytes = new byte[] { 1, 2, 3 };
@@ -78,6 +80,7 @@ public class ByteBufferConverterTests {
assertThat(bytes, equalTo(convert.array()));
}
private static class OtherType {
private byte[] bytes;
@@ -88,8 +91,8 @@ public class ByteBufferConverterTests {
}
private static class ByteArrayToOtherTypeConverter implements
Converter<byte[], OtherType> {
private static class ByteArrayToOtherTypeConverter implements Converter<byte[], OtherType> {
@Override
public OtherType convert(byte[] source) {
@@ -97,8 +100,8 @@ public class ByteBufferConverterTests {
}
}
private static class OtherTypeToByteArrayConverter implements
Converter<OtherType, byte[]> {
private static class OtherTypeToByteArrayConverter implements Converter<OtherType, byte[]> {
@Override
public byte[] convert(OtherType source) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@ import static java.lang.String.*;
*/
public enum TestGroup {
/**
* Tests that take a considerable amount of time to run. Any test lasting longer than
* 500ms should be considered a candidate in order to avoid making the overall test
@@ -68,6 +67,7 @@ public enum TestGroup {
*/
CUSTOM_COMPILATION;
/**
* Parse the specified comma separated string of groups.
* @param value the comma separated string of groups
@@ -102,4 +102,5 @@ public enum TestGroup {
}
return groups;
}
}