261 lines
21 KiB
Plaintext
261 lines
21 KiB
Plaintext
|
|
Apache Commons Collections
|
|
Version 4.0
|
|
RELEASE NOTES
|
|
|
|
INTRODUCTION:
|
|
|
|
Commons collections is a project to develop and maintain collection classes
|
|
based on and inspired by the JDK collection framework.
|
|
This version uses the generics features of Java 5 and is not compatible with
|
|
earlier JDK versions.
|
|
|
|
The process of generifying an API is complex.
|
|
For commons-collections, we have chosen to break the API in various ways.
|
|
The aim behind this is to provide an API design that better suits generics.
|
|
We have also removed all deprecated classes and fixed oddities in the previous
|
|
API that we couldn't fix due to backwards compatibility restrictions.
|
|
|
|
As such, this release can not be considered to be a simple, drop-in, replacement
|
|
for commons-collections. To help with the migration to this new version, the
|
|
package has changed to "org.apache.commons.collections4", thus it is possible
|
|
to have both commons-collections versions in the classpath.
|
|
|
|
These release notes will try to guide you in the process of upgrading, however you
|
|
should remember that this is a new API based on the original, so some concepts
|
|
have changed.
|
|
|
|
Major changes since 3.2.1
|
|
-------------------------
|
|
|
|
- Use of generics for the API
|
|
- Removed deprecated classes / methods and features which are now supported by the JDK
|
|
- Replaced Buffer interface with java.util.Queue
|
|
|
|
|
|
Removed classes
|
|
---------------
|
|
|
|
o [COLLECTIONS-458] Removed unused class "AbstractUntypedCollectionDecorator<E, D>"
|
|
o [COLLECTIONS-432] Removed "Buffer" interface and all its implementations and related classes.
|
|
Replaced by "java.util.Queue", see also section [New classes]
|
|
|
|
- PriorityBuffer: use either java.util.PriorityQueue or java.util.concurrent.PriorityBlockingQueue
|
|
- SynchronizedBuffer: use the corresponding *BlockingQueue classes in java.util.concurrent
|
|
- BoundedBuffer: use either ArrayBlockingBuffer(capacity) or LinkedBlockingBuffer(capacity) in java.util.concurrent
|
|
- UnboundedFifoBuffer: use either java.util.LinkedList or java.util.concurrent.LinkedBlockingBuffer
|
|
|
|
o [COLLECTIONS-351] Removed features now supported by the JDK
|
|
|
|
- FastArrayList: use java.util.concurrent.CopyOnWriteArrayList
|
|
- FastHashMap: use java.util.concurrent.ConcurrentHashMap, but beware of null keys and values
|
|
- FastTreeSet: no direct replacement, use ConcurrentHashMap or a synchronized TreeMap
|
|
- IdentityMap: use java.util.IdentityHashMap
|
|
- ExtendedProperties: use commons-configuration
|
|
- Synchronized[List,Set,SortedSet]: use java.util.Collections.synchronized*()
|
|
- Typed* decorators: use generics for type safety, or java.util.Collections.checked*()
|
|
- [List,Set,Map]Utils.EMPTY_*: use the corresponding fields in java.util.Collections
|
|
|
|
o [COLLECTIONS-229] Removed deprecated collection classes and methods
|
|
|
|
|
|
New classes
|
|
-----------
|
|
|
|
o [COLLECTIONS-432] CircularFifoQueue - analogous class to CircularFifoBuffer for the Queue interface
|
|
PredicatedQueue - analogous class to PredicatedBuffer
|
|
TransformedQueue - analogous class to TransformedBuffer
|
|
UnmodifiableQueue - analogous class to UnmodifiableBuffer
|
|
QueueUtils - analogous class to BufferUtils
|
|
o [COLLECTIONS-422] PermutationIterator - generates unordered permutations of a collection. Thanks to Benoit Corne.
|
|
o [COLLECTIONS-404] SequencesComparator - an implementation of Eugene Myers difference algorithm in package o.a.c.c.sequence. Thanks to Jordane Sarda.
|
|
o [COLLECTIONS-396] LazyIteratorChain - a variant of IteratorChain which supports lazy initialization. Thanks to Jeff Rodriguez.
|
|
o [COLLECTIONS-322] NodeListIterator - supports iteration over a org.w3c.dom.NodeList. Thanks to Thomas Vahrst.
|
|
o [COLLECTIONS-313] CatchAndRethrowClosure - re-throws any checked exception as unchecked "FunctorException". Thanks to David J. M. Karlsen.
|
|
o [COLLECTIONS-275] IndexedCollection - collection decorator which provides a map-like view on an existing collection. Thanks to Stephen Kestle.
|
|
o [COLLECTIONS-258] DualLinkedHashBidiMap - bidi map implementation using LinkedHashMap instances. Thanks to Nathan Blomquist.
|
|
o [COLLECTIONS-242] Equator - interface for testing object equality.
|
|
o [COLLECTIONS-241] PassiveExpiringMap - map decorator which passively expires entries. Thanks to Elifarley Callado Coelho.
|
|
o [COLLECTIONS-8 ] ComparatorPredicate - predicate to compare objects against a fixed instance. Thanks to Rune Peter Bjørnstad.
|
|
|
|
|
|
New methods in *Utils
|
|
---------------------
|
|
|
|
o [COLLECTIONS-456] ListUtils#longestCommonSubsequence(...) to get the longest common subsequence of arbitrary lists or CharSequences.
|
|
o [COLLECTIONS-450] CollectionUtils#forAllButLastDo(Collection, Closure) and forAllButLastDo(Iterator, Closure). Thanks to J. Moldawski.
|
|
o [COLLECTIONS-446] CollectionUtils#isEqualCollection(Collection, Collection, Equator). Thanks to Matt Lachman.
|
|
o [COLLECTIONS-436] *Utils#emptyIfNull(*) methods in classes CollectionUtils, ListUtils, SetUtils and MapUtils. Thanks to Arman Sharif.
|
|
o [COLLECTIONS-429] CollectionUtils#containsAll(Collection, Collection) with guaranteed runtime complexity of O(n + m)
|
|
+COLLECTIONS-434] and space complexity of O(n). This method may yield much better performance than Collection.containsAll(Collection)
|
|
depending on the use-case and type of collection used. Thanks to Adrian Nistor, Mert Guldur.
|
|
o [COLLECTIONS-422] CollectionUtils#permutations(Collection) to generate all permutations of a collection. Thanks to Benoit Corne.
|
|
o [COLLECTIONS-405] ListUtils#select() and ListUtils#selectRejected() methods. Thanks to Adam Dyga.
|
|
o [COLLECTIONS-393] ListUtils#partition() to split a List into consecutive sublists. Thanks to Chris Shayan.
|
|
o [COLLECTIONS-383] CollectionUtils#forAllDo(Iterator, Closure). Thanks to Adrian Cumiskey.
|
|
o [COLLECTIONS-375] ListUtils#defaultIfNull(List, List). Thanks to Ivan Hristov.
|
|
o [COLLECTIONS-361] CollectionUtils#filterInverse(Iterable, Predicate). Thanks to Jean-Noel Rouvignac.
|
|
o [COLLECTIONS-306] CollectionUtils#subtract(Iterable, Iterable, Predicate). Thanks to Chris Shayan.
|
|
o [COLLECTIONS-296] CollectionUtils#collate(...) to merge two sorted Collections using the standard O(n) merge algorithm. Thanks to Julius Davies.
|
|
o [COLLECTIONS-286] CollectionUtils#extractSingleton(Collection). Thanks to Geoffrey De Smet.
|
|
o [COLLECTIONS-263] MapUtils#populateMap(MultiMap, ...) to support also "MultiMap" instances as input. Thanks to John Hunsley.
|
|
o [COLLECTIONS-235] ListUtils#indexOf(List, Predicate). Thanks to Nathan Egge.
|
|
o [COLLECTIONS-194] MapUtils#populateMap(Map, Collection, Transformer, ...). Thanks to Dave Meikle.
|
|
|
|
|
|
New features
|
|
------------
|
|
|
|
o [COLLECTIONS-399] Added new method "get(int)" to "CircularFifoQueue". Thanks to Sebb.
|
|
o [COLLECTIONS-327] Added serialVersionUID fields for "CompositeCollection", "CompositeSet", "EmptyMapMutator", "EmptySetMutator". Thanks to sebb.
|
|
o [COLLECTIONS-293] Added support for using custom "Equator" objects in "EqualPredicate". Thanks to Stephen Kestle.
|
|
o [COLLECTIONS-289] Added method "CollatingIterator#getIteratorIndex()". Thanks to Fredrik Kjellberg.
|
|
o [COLLECTIONS-285] Added serialization support for "TreeBidiMap". Thanks to Christian Gruenberg.
|
|
o [COLLECTIONS-272] Added serialization support for "FixedOrderComparator" and "TransformingComparator". Thanks to Chaitanya Mutyala.
|
|
o [COLLECTIONS-260] Added constructor "TransformingComparator(Transformer)". Thanks to Stephen Kestle.
|
|
o [COLLECTIONS-237] Added method "MultiValueMap#iterator()" to return a flattened version of "entrySet().iterator()".
|
|
Clarified javadoc for "entrySet()" that the returned Entry objects are unflattened, i.e. the Entry object
|
|
for a given key contains all values mapped to this key. Thanks to Nils Kaiser, Alan Mehlo.
|
|
o [COLLECTIONS-226] Added method "ListOrderedMap#putAll(int, Map)". Thanks to Vasily Ivanov.
|
|
o [COLLECTIONS-213] Added support for resettable iterators in "IteratorIterable". Thanks to Dusan Chromy.
|
|
|
|
|
|
Changed classes / methods
|
|
-------------------------
|
|
|
|
o [COLLECTIONS-454] An iterator over a "Flat3Map#entrySet()" will now return independent Map.Entry objects that will
|
|
not change anymore when the iterator progresses.
|
|
o [COLLECTIONS-452] Change base package to "org.apache.commons.collections4".
|
|
o [COLLECTIONS-451] The constructors for all *Utils classes are now private to prevent instantiation.
|
|
o [COLLECTIONS-424] "CompositeSet" does not inherit from "CompositeCollection" anymore. The inner class "SetMutator"
|
|
has been updated accordingly. Thanks to Michael Pradel.
|
|
o [COLLECTIONS-382] Change maven coordinates to "org.apache.commons.commons-collections4". Thanks to Olivier Lamy.
|
|
o [COLLECTIONS-381] Move the project structure to a standard maven layout. Thanks to Olivier Lamy.
|
|
o [COLLECTIONS-372] TransformingComparator now supports different types for its input/output values.
|
|
o [COLLECTIONS-362] "CollectionUtils#filter(Iterable, Predicate)" will now return whether the collection has been modified.
|
|
Thanks to Jean-Noel Rouvignac.
|
|
o [COLLECTIONS-341] "NOPClosure" is now a final class. Thanks to Goran Hacek.
|
|
o [COLLECTIONS-324] Fields transformer and decorated in class "TransformingComparator" are now final. Thanks to sebb.
|
|
o [COLLECTIONS-307] "SetUniqueList#subList()" will now return an unmodifiable list as changes to it may invalidate the parent list.
|
|
Thanks to Christian Semrau, Thomas Vahrst.
|
|
o [COLLECTIONS-298] Calling "CollectionUtils#sizeIsEmpty(null)" will now return true. Thanks to Benjamin Bentmann.
|
|
o [COLLECTIONS-280] The predicate that rejected an object to be added to a "PredicatedCollection" is now contained in the
|
|
respective exception message. Thanks to Chris Lewis.
|
|
o [COLLECTIONS-265] "TreeBag" will now only accept "Comparable" objects as input when used with natural ordering. Thanks to David Saff.
|
|
o [COLLECTIONS-251] The static factory methods have been renamed from "getInstance()" to a camel-case version of the class name,
|
|
+COLLECTIONS-321] e.g. "truePredicate()" for class "TruePredicate". Thanks to Stephen Kestle.
|
|
o [COLLECTIONS-240] "MultiValueMap" is now serializable. Thanks to Wouter de Vaal.
|
|
o [COLLECTIONS-231] Return concrete class in static factory methods instead of base class interface
|
|
(except for Unmodifiable decorators). Thanks to Torsten Curdt.
|
|
o [COLLECTIONS-230] "CollectionUtils#size(Collection)" now returns 0 when called with null as input. Thanks to Stepan Koltsov,sebb.
|
|
+COLLECTIONS-297]
|
|
+COLLECTIONS-318]
|
|
o [COLLECTIONS-223] "CollectionUtils#addAll(...)" methods now return if the collection has been changed by this operation.
|
|
Thanks to Vasily Ivanov.
|
|
o [COLLECTIONS-221] "CompositeCollection", "CompositeMap" and "CompositeSet" are now serializable. Thanks to Pal Denes.
|
|
o [COLLECTIONS-218] The "CollectionUtils#select(Collection, Predicate, Collection)" method will now return the output collection.
|
|
o [COLLECTIONS-182] "CollectionUtils#forAllDo(Collection, Closure)" now returns the provided closure. Thanks to Jim Cakalic.
|
|
o [COLLECTIONS-110] Make generic versions of all classes in collections.
|
|
+COLLECTIONS-243]
|
|
+COLLECTIONS-245]
|
|
+COLLECTIONS-247]
|
|
+COLLECTIONS-253]
|
|
+COLLECTIONS-273]
|
|
+COLLECTIONS-282]
|
|
o [None ] Switch Abstract*Decorator classes to expose decorated() protected method instead of the decorated collection directly.
|
|
Each class overrides decorated() to add its type covariantly, thus getList()/getSet() etc. methods are removed
|
|
o [None ] ArrayStack is now deprecated and will be removed in the next major release. It is replaced by the java.util.Deque
|
|
interface available from Java 6.
|
|
|
|
|
|
Fixed Bugs
|
|
----------
|
|
|
|
o [COLLECTIONS-447] Tree traversal with a TreeListIterator will not be affected anymore by the removal of an element directly after
|
|
a call to previous(). Thanks to Jeffrey Barnes.
|
|
o [COLLECTIONS-445] Adapt and/or ignore several unit tests when run on a IBM J9 VM (specification version 1.6.0) due to a faulty
|
|
"java.util.TreeMap" implementation.
|
|
o [COLLECTIONS-444] SetUniqueList.set(int, E) now works correctly if the object to be inserted is already placed at the given position.
|
|
Thanks to Thomas Vahrst, John Vasileff.
|
|
o [COLLECTIONS-441] MultiKeyMap.clone() now correctly calls super.clone(). Thanks to Thomas Vahrst.
|
|
o [COLLECTIONS-433] Improve performance of "TreeList#addAll" and "TreeList(Collection)" by converting the input collection into an
|
|
AVL tree and efficiently merge it into the existing tree. Thanks to Jeffrey Barnes.
|
|
o [COLLECTIONS-427] Fixed performance issue in "SetUniqueList#retainAll" method for large collections. Thanks to Mert Guldur.
|
|
o [COLLECTIONS-426] Fixed performance issue in "ListOrderedSet#retainAll" method for large collections. Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-425] Improved performance of "ListOrderedMap#remove(Object)" method. Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-421] Update javadoc for "ListUtils#lazyList()" and "ListUtils#fixedSizeList()". Thanks to Benedikt Ritter.
|
|
o [COLLECTIONS-419] Added clarifying javadoc wrt runtime complexity of "AbstractDualBidiMap#retainAll". Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-417] Added clarifying javadoc wrt runtime complexity of "AbstractLinkedList#retainAll". Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-415] Added clarifying javadoc wrt runtime complexity of "AbstractLinkedList#removeAll". Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-414] Fixed several compilation issues with older Java 1.6 compilers.
|
|
o [COLLECTIONS-413] Improved performance of "removeAll()" method for sets returned by "DualHashBidiMap#entrySet()". Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-412] Improved performance of "CollectionUtils#subtract" methods. Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-411] Fixed possible "IndexOutOfBoundsException" in "ListOrderedMap#putAll". Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-410] Improved performance of "SetUniqueList#addAll" method. Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-409] Improved performance of "ListOrderedSet#addAll" method. Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-408] Improved performance of "SetUniqueList#removeAll". Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-407] Improved performance of "ListOrderedSet#remove(Object)" in case the object is not contained in the Set. Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-406] Improved performance of "ListUtils#subtract" method. Thanks to Adrian Nistor.
|
|
o [COLLECTIONS-400] Added missing null check in "CollectionUtils#addIgnoreNull(Collection, Object)". Thanks to Shin Hwei Tan.
|
|
o [COLLECTIONS-391] Fixed javadoc for "MapUtils#toProperties(Map)". Thanks to Shin Hwei Tan.
|
|
o [COLLECTIONS-389] Clarified javadoc for "TransformerUtils#mapTransformer" for null input. Thanks to Shin Hwei Tan.
|
|
o [COLLECTIONS-388] Clarified javadoc for "FactoryUtils#prototypeFactory" for null input. Thanks to Shin Hwei Tan.
|
|
o [COLLECTIONS-384] Fixed inconsistent javadoc for "MapUtils#synchronizedMap(Map)". Thanks to Shin Hwei Tan.
|
|
o [COLLECTIONS-380] Fixed infinite loop when calling "UnmodifiableBoundedCollection#unmodifiableBoundedCollection()". Thanks to Dave Brosius.
|
|
o [COLLECTIONS-379] Fixed javadoc for several methods wrt expected NullPointerExceptions. Thanks to Shin Hwei Tan.
|
|
o [COLLECTIONS-364] "DualTreeBidiMap" now uses the correct comparator for the reverse map during de-serialization.
|
|
o [COLLECTIONS-363] "TransformedMap" in the package "splitmap" can now be serialized.
|
|
o [COLLECTIONS-360] "FilterListIterator#hasNext" does not throw a NullPointerException anymore to comply to the Java iterator specification.
|
|
Thanks to Sai Zhang.
|
|
o [COLLECTIONS-359] "ListUtils#intersection(List, List)" will now also work correctly if there are duplicate elements in the provided lists.
|
|
Thanks to Mark Shead.
|
|
o [COLLECTIONS-352] "AbstractCollectionDecorator" will now use internally "decorated()" to access the decorated collection. Thanks to Adam Gent.
|
|
o [COLLECTIONS-350] Removed debug output in "MapUtils#getNumber(Map)". Thanks to Michael Akerman.
|
|
o [COLLECTIONS-348] Fixed javadoc for all "transformedXXX(XXX)" methods in the respective Utils classes to clarify that existing objects in the
|
|
list are not transformed. Thanks to Paul Benedict.
|
|
o [COLLECTIONS-343] Singleton classes in package "functors" are now correctly de-serialized. Thanks to Goran Hacek.
|
|
o [COLLECTIONS-340] Removed broken methods "equals(Object)" and "hashCode()" in class "NOPClosure". Thanks to Goran Hacek.
|
|
o [COLLECTIONS-336] Simplified exceptions as the cause is available from the parent. Thanks to sebb.
|
|
o [COLLECTIONS-335] Fixed cache assignment for "TreeBidiMap#entrySet". Thanks to sebb.
|
|
o [COLLECTIONS-334] Synchronized access to lock in "StaticBucketMap#size()". Thanks to sebb.
|
|
o [COLLECTIONS-332] Added clarification to javadoc of "ListOrderedMap" that "IdentityMap" and "CaseInsensitiveMap" are not supported.
|
|
Thanks to Tom Parker.
|
|
o [COLLECTIONS-331] Improve javadoc of "CollatingIterator" wrt the used "Comparator" and throw a NullPointerException in "CollatingIterator#least"
|
|
if no comparator is set. Thanks to Michael Krkoska.
|
|
o [COLLECTIONS-330] "LRUMap#keySet()#remove(Object)" will not throw a "ConcurrentModificationException" anymore. Thanks to Joerg Schaible.
|
|
o [COLLECTIONS-328] Improved performance of "ListUtils#intersection(List, List)". Thanks to Thomas Rogan, Jilles van Gurp.
|
|
o [COLLECTIONS-323] Changed behavior of "CaseInsensitiveMap" constructor to be compliant with "HashMap" in case the initial capacity is set to zero.
|
|
Thanks to Maarten Brak.
|
|
o [COLLECTIONS-320] Improved performance of "StaticBucketMap#putAll(Map)" by iterating over the entry set. Thanks to sebb.
|
|
o [COLLECTIONS-319] Avoid redundant null check in "IteratorUtils#getIterator(Object)". Thanks to sebb.
|
|
o [COLLECTIONS-317] Use a private method to populate the object in "AbstractHashedMap(Map)". Thanks to sebb.
|
|
o [COLLECTIONS-316] Fixed javadoc of "LRUMap" wrt to the maxSize parameter of the constructor. Thanks to ori.
|
|
o [COLLECTIONS-312] Use of final keyword where applicable, minor performance improvements by properly initializing the capacity of newly created
|
|
collections when known in advance. Thanks to Peter Lawrey, Gary Gregory.
|
|
o [COLLECTIONS-307] "SetUniqueList#subList()#contains(Object)" will now correctly check the subList rather than the parent list.
|
|
Thanks to Christian Semrau.
|
|
o [COLLECTIONS-304] "SetUniqueList#set(int, Object)" will now correctly enforce the uniqueness constraint. Thanks to Rafał Figas,Bjorn Townsend.
|
|
o [COLLECTIONS-303] Improved javadoc for "Unmodifiable*" classes wrt behavior when the users tries to modify the collection. Thanks to Emmanuel Bourg.
|
|
o [COLLECTIONS-294] "CaseInsensitiveMap" will now convert input strings to lower-case in a locale-independant manner. Thanks to Benjamin Bentmann.
|
|
o [COLLECTIONS-256] Fixed javadoc for "ListUtils#transformedList(List)" to clarify that existing objects in the list are not transformed.
|
|
+COLLECTIONS-288] Thanks to Paul Benedict.
|
|
o [COLLECTIONS-266] "MultiKey" will now be correctly serialized/de-serialized. Thanks to Joerg Schaible.
|
|
o [COLLECTIONS-262] Fixed javadoc for methods "firstKey()" and "lastKey()" in class "AbstractLinkedMap". Thanks to Lisen Mu.
|
|
o [COLLECTIONS-261] "Flat3Map#remove(Object)" will now return the correct value mapped to the removed key if the size of the map is less or equal 3.
|
|
Thanks to ori.
|
|
o [COLLECTIONS-255] Removed unused variables in "TreeBidiMap". Thanks to Henri Yandell.
|
|
o [COLLECTIONS-249] "SetUniqueList.addAll(int, Collection)" now correctly add the collection at the provided index. Thanks to Joe Kelly.
|
|
o [COLLECTIONS-232] Fixed several unit tests which were using parameters to "assertEquals(...)" in wrong order. Thanks to Mark Hindess.
|
|
o [COLLECTIONS-228] "MultiValueMap#put(Object, Object)" and "MultiValueMap#putAll(Object, Collection)" now correctly return if the map
|
|
has changed by this operation.
|
|
o [COLLECTIONS-219] "CollectionUtils#removeAll" wrongly called "ListUtils#retainAll". Thanks to Tom Leccese.
|
|
o [COLLECTIONS-217] Calling "setValue(Object)" on any Entry returned by a "Flat3Map" will now correctly set the value for the current entry.
|
|
Thanks to Matt Bishop.
|
|
o [COLLECTIONS-216] "MultiKey#toString()" will now use "Arrays#toString(List)". Thanks to Hendrik Maryns.
|
|
|
|
|
|
For complete information on Commons Collections, including instructions on how to submit bug reports,
|
|
patches, or suggestions for improvement, see the Apache Commons Collections website:
|
|
|
|
http://commons.apache.org/proper/commons-collections/
|