[COLLECTIONS-571] Deprecate CollectionUtils.{synchronized,unmodifiable}Collection.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1686826 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2015-06-22 10:17:20 +00:00
parent 9f363c0dae
commit 0acb702f3e
3 changed files with 12 additions and 2 deletions

View File

@ -22,6 +22,10 @@
<body>
<release version="4.1" date="TBD" description="">
<action issue="COLLECTIONS-571" dev="tn" type="update">
Deprecated methods "synchronizedCollection(Collection)" and "unmodifiableCollection(Collection)"
in class "CollectionUtils", the corresponding methods in "java.util.Collections" should be used instead.
</action>
<action issue="COLLECTIONS-566" dev="tn" type="fix">
"IteratorUtils#collate(...)" methods did not use natural ordering when a
null comparator was provided.

View File

@ -1808,7 +1808,9 @@ public class CollectionUtils {
* @param collection the collection to synchronize, must not be null
* @return a synchronized collection backed by the given collection
* @throws IllegalArgumentException if the collection is null
* @deprecated since 4.1, use {@link java.util.Collections#synchronizedCollection(Collection)} instead
*/
@Deprecated
public static <C> Collection<C> synchronizedCollection(final Collection<C> collection) {
return SynchronizedCollection.synchronizedCollection(collection);
}
@ -1822,7 +1824,9 @@ public class CollectionUtils {
* @param collection the collection to make unmodifiable, must not be null
* @return an unmodifiable collection backed by the given collection
* @throws IllegalArgumentException if the collection is null
* @deprecated since 4.1, use {@link java.util.Collections#unmodifiableCollection(Collection)} instead
*/
@Deprecated
public static <C> Collection<C> unmodifiableCollection(final Collection<? extends C> collection) {
return UnmodifiableCollection.unmodifiableCollection(collection);
}

View File

@ -1524,18 +1524,20 @@ public class CollectionUtilsTest extends MockTestCase {
}
@Test
@Deprecated
public void testSynchronizedCollection() {
Collection<Object> col = CollectionUtils.synchronizedCollection(new ArrayList<Object>());
assertTrue("Returned object should be a SynchronizedCollection.", col instanceof SynchronizedCollection);
try {
CollectionUtils.synchronizedCollection(null);
fail("Expecting IllegalArgumentException for null collection.");
} catch (final IllegalArgumentException ex) {
fail("Expecting NullPointerException for null collection.");
} catch (final NullPointerException ex) {
// expected
}
}
@Test
@Deprecated
public void testUnmodifiableCollection() {
Collection<Object> col = CollectionUtils.unmodifiableCollection(new ArrayList<Object>());
assertTrue("Returned object should be a UnmodifiableCollection.", col instanceof UnmodifiableCollection);