Improved Java Collection APIs
john_platts at hotmail.com
Fri Nov 19 07:49:43 PST 2010
Here are improvements that I really want to see to Java Collection APIs:
- Addition of an equality comparator interface.
- An wrapper that wraps a java.util.Comparator as a equality comparator.
- Map and set classes that allow an equality comparator to be used instead of the equals() method or identity comparisons
- New map and set interfaces that behave like the existing java.util.Map and java.util.Set interfaces. Unlike the contract of the java.util.Map and java.util.Set interfaces, the contract of the new map and set interfaces will not require that o1 be considered to be equal to o2 when o1 != o2 and o1.equals(o2) are both true. The new map and set interfaces will still require that o1 be considered equal to o2 whenever o1 == o2 is true.
- New collection interfaces which define versions of search and removal operations that take an additional equality comparator argument. This enables search and removal operations to use an equality comparator to determine equality instead of relying on the equals method, an identity comparison, or the java.util.Comparator.compare method.
- Additional concurrent collection classes. Some of these classes will require synchronized modification, while supporting thread-safe unsynchronized access and concurrent iteration.
- Support for collections synchronized on a read-write lock.
- Addition of methods that iterates through the collection and invokes a callback. This is useful in cases where the callback object can be pre-allocated, since iteration using a java.util.Iterator object usually requires an iterator to be allocated each time an iteration takes place.
More information about the core-libs-dev