commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] [Commented] (COLLECTIONS-485) Collection copy-constructors should accept wildcarded input
Date Sat, 05 Oct 2013 08:50:42 GMT


Sebb commented on COLLECTIONS-485:

Note: the standard Java classes use wildcards for copy ctors. 
There are some exceptions with regard to wildcard Map keys. For example:

ConcurrentSkipListMap(Map<? extends K, ? extends V> m)
ConcurrentSkipListMap(SortedMap<K, ? extends V> m)

Same applies to TreeMap.

EnumMap(Map<K, ? extends V> m)
EnumMap(EnumMap<K, ? extends V> m)

So I wonder whether there are some copy constructors that should not use wildcard keys, for
BagUtils.unmodifiableBag(final Bag<E> bag)

> Collection copy-constructors should accept wildcarded input
> -----------------------------------------------------------
>                 Key: COLLECTIONS-485
>                 URL:
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Bag, BidiMap, Collection, List, Map, Set
>    Affects Versions: 4.0-alpha1
>            Reporter: Hollis Waite
>         Attachments: CaseInsensitiveMap.patch, wildcards.patch
> Many Collection constructors copy input in order to self-populate. For convenience (and
consistency with standard Java collections library), wildcarded parameters should be accepted
where possible. Unmodifiable* classes might also benefit from less restrictive generic signatures.

This message was sent by Atlassian JIRA

View raw message