|
Description
|
A DESCRIPTION OF THE REQUEST :
In JDK1.5 beta, in the package << java.util >> ; these methods were added, in the class java.util.Collections :
- public static <E> Collection<E> checkedCollection(Collection<E> c, Class<E> type);
- public static <E> SortedSet<E> checkedSortedSet(SortedSet<E> s,Class<E> type);
- public static <E> List<E> checkedList(List<E> list,Class<E> type);
- public static <K,V> Map<K,V> checkedMap(Map<K,V> m,Class<K> keyType,Class<V> valueType);
- public static <K,V> SortedMap<K,V> checkedSortedMap(SortedMap<K,V> m,Class<K> keyType,Class<V> valueType)
But this one is missing :
- public static <E> Queue<E> checkedQueue(Queue<E> list,Class<E> type);
java.util.Queue is a new interface for a collection.
JUSTIFICATION :
Justification : scalability ?
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Queue<String> myCheckedQueue = Collections.checkedQueue( new PriorityQueue(), String.class );
(Incident Review ID: 246800)
======================================================================
Posted Date : 2005-08-10 05:36:32.0
|
|
Evaluation
|
This is an unintentional oversight, and should be added. Ideally it should be added in Tiger (at the same time as the Queue interface is added to the platform). In fact, we should have CheckedBlockingQueue as well. This will cause an unfortunate dependency of java.util on java.util.concurrent, but c'est la vie.
xxxxx@xxxxx 2004-04-13
Soon there'll be deques, navigablesets, blocking queues and blocking deques as well.
Each new collection class exacts a cost.
xxxxx@xxxxx 2005-05-12 03:05:11 GMT
Contribution forum : https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?forumID=1463&messageID=20658
Posted Date : 2007-07-17 01:53:02.0
|