From 5a2fc907469754e2c2a4ef2a9cad3df6ad94dd21 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Wed, 20 Jul 2011 14:44:46 +0000 Subject: [PATCH] [COLLECTIONS-251] improving static factory methods for static importability, conistency git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1148801 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/commons/collections/BagUtils.java | 28 ++--- .../commons/collections/BufferUtils.java | 20 +-- .../commons/collections/ClosureUtils.java | 32 ++--- .../commons/collections/CollectionUtils.java | 16 +-- .../commons/collections/ComparatorUtils.java | 4 +- .../commons/collections/FactoryUtils.java | 12 +- .../commons/collections/IteratorUtils.java | 16 +-- .../apache/commons/collections/ListUtils.java | 12 +- .../apache/commons/collections/MapUtils.java | 36 +++--- .../commons/collections/PredicateUtils.java | 118 ++++++++++++++---- .../apache/commons/collections/SetUtils.java | 20 +-- .../commons/collections/TransformerUtils.java | 45 +++---- .../collections/bag/AbstractMapBag.java | 2 +- .../collections/bag/PredicatedBag.java | 2 +- .../collections/bag/PredicatedSortedBag.java | 2 +- .../collections/bag/SynchronizedBag.java | 2 +- .../bag/SynchronizedSortedBag.java | 2 +- .../collections/bag/TransformedBag.java | 12 +- .../collections/bag/TransformedSortedBag.java | 8 +- .../collections/bag/UnmodifiableBag.java | 7 +- .../bag/UnmodifiableSortedBag.java | 6 +- .../collections/bidimap/TreeBidiMap.java | 4 +- .../bidimap/UnmodifiableBidiMap.java | 10 +- .../bidimap/UnmodifiableOrderedBidiMap.java | 10 +- .../bidimap/UnmodifiableSortedBidiMap.java | 16 +-- .../collections/buffer/BlockingBuffer.java | 4 +- .../collections/buffer/BoundedBuffer.java | 4 +- .../collections/buffer/PredicatedBuffer.java | 2 +- .../collections/buffer/PriorityBuffer.java | 2 +- .../buffer/SynchronizedBuffer.java | 2 +- .../collections/buffer/TransformedBuffer.java | 8 +- .../buffer/UnmodifiableBuffer.java | 4 +- .../collection/CompositeCollection.java | 4 +- .../collection/PredicatedCollection.java | 2 +- .../collection/SynchronizedCollection.java | 2 +- .../collection/TransformedCollection.java | 8 +- .../UnmodifiableBoundedCollection.java | 8 +- .../collection/UnmodifiableCollection.java | 4 +- .../comparators/BooleanComparator.java | 4 +- .../comparators/ComparableComparator.java | 4 +- .../collections/functors/AndPredicate.java | 2 +- .../collections/functors/AnyPredicate.java | 4 +- .../collections/functors/ChainedClosure.java | 25 +--- .../functors/ChainedTransformer.java | 25 +--- .../functors/CloneTransformer.java | 4 +- .../functors/ClosureTransformer.java | 2 +- .../functors/ComparatorPredicate.java | 6 +- .../collections/functors/ConstantFactory.java | 2 +- .../functors/ConstantTransformer.java | 6 +- .../collections/functors/DefaultEquator.java | 2 +- .../collections/functors/EqualPredicate.java | 2 +- .../functors/ExceptionClosure.java | 2 +- .../functors/ExceptionFactory.java | 2 +- .../functors/ExceptionPredicate.java | 2 +- .../functors/ExceptionTransformer.java | 2 +- .../functors/FactoryTransformer.java | 2 +- .../collections/functors/FalsePredicate.java | 2 +- .../collections/functors/ForClosure.java | 4 +- .../functors/IdentityPredicate.java | 2 +- .../collections/functors/IfClosure.java | 6 +- .../functors/InstanceofPredicate.java | 2 +- .../functors/InstantiateFactory.java | 2 +- .../functors/InstantiateTransformer.java | 4 +- .../functors/InvokerTransformer.java | 4 +- .../collections/functors/MapTransformer.java | 4 +- .../collections/functors/NOPClosure.java | 2 +- .../collections/functors/NOPTransformer.java | 2 +- .../collections/functors/NonePredicate.java | 4 +- .../functors/NotNullPredicate.java | 2 +- .../collections/functors/NotPredicate.java | 2 +- .../functors/NullIsExceptionPredicate.java | 2 +- .../functors/NullIsFalsePredicate.java | 2 +- .../functors/NullIsTruePredicate.java | 2 +- .../collections/functors/OnePredicate.java | 4 +- .../collections/functors/OrPredicate.java | 2 +- .../functors/PredicateTransformer.java | 2 +- .../functors/PrototypeFactory.java | 4 +- .../functors/StringValueTransformer.java | 2 +- .../collections/functors/SwitchClosure.java | 10 +- .../functors/SwitchTransformer.java | 12 +- .../functors/TransformedPredicate.java | 2 +- .../functors/TransformerClosure.java | 4 +- .../functors/TransformerPredicate.java | 2 +- .../collections/functors/UniquePredicate.java | 2 +- .../collections/functors/WhileClosure.java | 2 +- .../iterators/CollatingIterator.java | 2 +- .../collections/iterators/EmptyIterator.java | 4 +- .../iterators/EmptyListIterator.java | 4 +- .../iterators/EmptyMapIterator.java | 2 +- .../iterators/EmptyOrderedIterator.java | 2 +- .../iterators/EmptyOrderedMapIterator.java | 2 +- .../collections/iterators/IteratorChain.java | 6 +- .../iterators/ObjectArrayIterator.java | 2 +- .../iterators/ObjectArrayListIterator.java | 2 +- .../iterators/UniqueFilterIterator.java | 2 +- .../iterators/UnmodifiableIterator.java | 2 +- .../iterators/UnmodifiableListIterator.java | 2 +- .../iterators/UnmodifiableMapIterator.java | 2 +- .../UnmodifiableOrderedMapIterator.java | 2 +- .../collections/list/FixedSizeList.java | 4 +- .../commons/collections/list/GrowthList.java | 2 +- .../commons/collections/list/LazyList.java | 2 +- .../collections/list/PredicatedList.java | 2 +- .../collections/list/SetUniqueList.java | 4 +- .../collections/list/SynchronizedList.java | 2 +- .../collections/list/TransformedList.java | 8 +- .../collections/list/UnmodifiableList.java | 8 +- .../collections/map/AbstractHashedMap.java | 8 +- .../collections/map/AbstractLinkedMap.java | 8 +- .../commons/collections/map/CompositeMap.java | 2 +- .../commons/collections/map/DefaultedMap.java | 12 +- .../commons/collections/map/FixedSizeMap.java | 8 +- .../collections/map/FixedSizeSortedMap.java | 8 +- .../commons/collections/map/Flat3Map.java | 8 +- .../commons/collections/map/LazyMap.java | 6 +- .../collections/map/LazySortedMap.java | 5 +- .../commons/collections/map/LinkedMap.java | 8 +- .../collections/map/ListOrderedMap.java | 4 +- .../commons/collections/map/MultiKeyMap.java | 4 +- .../collections/map/MultiValueMap.java | 16 +-- .../collections/map/PredicatedMap.java | 2 +- .../collections/map/PredicatedSortedMap.java | 2 +- .../collections/map/TransformedMap.java | 8 +- .../collections/map/TransformedSortedMap.java | 8 +- .../collections/map/UnmodifiableEntrySet.java | 2 +- .../collections/map/UnmodifiableMap.java | 12 +- .../map/UnmodifiableOrderedMap.java | 10 +- .../map/UnmodifiableSortedMap.java | 8 +- .../commons/collections/set/CompositeSet.java | 2 +- .../collections/set/ListOrderedSet.java | 8 +- .../commons/collections/set/MapBackedSet.java | 6 +- .../collections/set/PredicatedSet.java | 2 +- .../collections/set/PredicatedSortedSet.java | 2 +- .../collections/set/SynchronizedSet.java | 2 +- .../set/SynchronizedSortedSet.java | 2 +- .../collections/set/TransformedSet.java | 8 +- .../collections/set/TransformedSortedSet.java | 8 +- .../collections/set/UnmodifiableSet.java | 4 +- .../set/UnmodifiableSortedSet.java | 4 +- .../AbstractIterableGetMapDecorator.java | 3 +- .../collections/splitmap/SplitMapUtils.java | 15 ++- .../collections/splitmap/TransformedMap.java | 9 +- .../commons/collections/TestBagUtils.java | 12 +- .../collections/TestCollectionUtils.java | 8 +- .../collections/bag/TestPredicatedBag.java | 2 +- .../bag/TestPredicatedSortedBag.java | 2 +- .../collections/bag/TestTransformedBag.java | 6 +- .../bag/TestTransformedSortedBag.java | 6 +- .../bidimap/TestDualTreeBidiMap2.java | 8 +- .../bidimap/TestUnmodifiableBidiMap.java | 4 +- .../TestUnmodifiableOrderedBidiMap.java | 4 +- .../TestUnmodifiableSortedBidiMap.java | 4 +- .../buffer/TestBlockingBuffer.java | 10 +- .../collections/buffer/TestBoundedBuffer.java | 16 +-- .../buffer/TestPredicatedBuffer.java | 2 +- .../buffer/TestSynchronizedBuffer.java | 4 +- .../buffer/TestTransformedBuffer.java | 4 +- .../buffer/TestUnmodifiableBuffer.java | 4 +- .../collection/TestPredicatedCollection.java | 2 +- .../TestSynchronizedCollection.java | 2 +- .../collection/TestTransformedCollection.java | 8 +- .../TestUnmodifiableCollection.java | 4 +- .../comparators/TestBooleanComparator.java | 8 +- .../functors/TestComparatorPredicate.java | 12 +- .../iterators/TestFilterIterator.java | 2 +- .../iterators/TestUnmodifiableIterator.java | 10 +- .../TestUnmodifiableListIterator.java | 10 +- .../TestUnmodifiableMapIterator.java | 10 +- .../TestUnmodifiableOrderedMapIterator.java | 14 +-- .../collections/list/TestFixedSizeList.java | 4 +- .../collections/list/TestGrowthList.java | 2 +- .../collections/list/TestPredicatedList.java | 2 +- .../collections/list/TestSetUniqueList.java | 10 +- .../list/TestSynchronizedList.java | 2 +- .../collections/list/TestTransformedList.java | 8 +- .../collections/map/TestDefaultedMap.java | 8 +- .../collections/map/TestFixedSizeMap.java | 4 +- .../map/TestFixedSizeSortedMap.java | 4 +- .../commons/collections/map/TestLazyMap.java | 10 +- .../collections/map/TestLazySortedMap.java | 16 +-- .../collections/map/TestListOrderedMap.java | 2 +- .../collections/map/TestMultiKeyMap.java | 2 +- .../collections/map/TestMultiValueMap.java | 6 +- .../collections/map/TestPredicatedMap.java | 2 +- .../map/TestPredicatedSortedMap.java | 2 +- .../collections/map/TestSingletonMap.java | 2 +- .../collections/map/TestTransformedMap.java | 10 +- .../map/TestTransformedSortedMap.java | 10 +- .../collections/map/TestUnmodifiableMap.java | 8 +- .../map/TestUnmodifiableOrderedMap.java | 10 +- .../map/TestUnmodifiableSortedMap.java | 8 +- .../collections/set/TestListOrderedSet.java | 12 +- .../collections/set/TestMapBackedSet.java | 2 +- .../collections/set/TestMapBackedSet2.java | 2 +- .../collections/set/TestPredicatedSet.java | 2 +- .../set/TestPredicatedSortedSet.java | 6 +- .../collections/set/TestSynchronizedSet.java | 2 +- .../set/TestSynchronizedSortedSet.java | 2 +- .../collections/set/TestTransformedSet.java | 8 +- .../set/TestTransformedSortedSet.java | 8 +- .../collections/set/TestUnmodifiableSet.java | 4 +- .../set/TestUnmodifiableSortedSet.java | 4 +- .../splitmap/TestSplitMapUtils.java | 2 +- .../splitmap/TestTransformedMap.java | 22 ++-- 204 files changed, 705 insertions(+), 663 deletions(-) diff --git a/src/java/org/apache/commons/collections/BagUtils.java b/src/java/org/apache/commons/collections/BagUtils.java index 839c2eade..ba93d020f 100644 --- a/src/java/org/apache/commons/collections/BagUtils.java +++ b/src/java/org/apache/commons/collections/BagUtils.java @@ -45,12 +45,12 @@ public class BagUtils { /** * An empty unmodifiable bag. */ - public static final Bag EMPTY_BAG = UnmodifiableBag.decorate(new HashBag()); + public static final Bag EMPTY_BAG = UnmodifiableBag.unmodifiableBag(new HashBag()); /** * An empty unmodifiable sorted bag. */ - public static final Bag EMPTY_SORTED_BAG = UnmodifiableSortedBag.decorate(new TreeBag()); + public static final Bag EMPTY_SORTED_BAG = UnmodifiableSortedBag.unmodifiableSortedBag(new TreeBag()); /** * Instantiation of BagUtils is not intended or required. However, some @@ -86,7 +86,7 @@ public class BagUtils { * @throws IllegalArgumentException if the Bag is null */ public static Bag synchronizedBag(Bag bag) { - return SynchronizedBag.decorate(bag); + return SynchronizedBag.synchronizedBag(bag); } /** @@ -99,7 +99,7 @@ public class BagUtils { * @throws IllegalArgumentException if the Bag is null */ public static Bag unmodifiableBag(Bag bag) { - return UnmodifiableBag.decorate(bag); + return UnmodifiableBag.unmodifiableBag(bag); } /** @@ -117,7 +117,7 @@ public class BagUtils { * @throws IllegalArgumentException if the Bag or Predicate is null */ public static Bag predicatedBag(Bag bag, Predicate predicate) { - return PredicatedBag.decorate(bag, predicate); + return PredicatedBag.predicatedBag(bag, predicate); } /** @@ -128,15 +128,15 @@ public class BagUtils { * as it is a backdoor for adding untransformed objects. *

* Existing entries in the specified bag will not be transformed. - * If you want that behaviour, see {@link TransformedBag#decorateTransform}. + * If you want that behaviour, see {@link TransformedBag#transformedBag(Bag, Transformer)}. * * @param bag the bag to predicate, must not be null * @param transformer the transformer for the bag, must not be null * @return a transformed bag backed by the given bag * @throws IllegalArgumentException if the Bag or Transformer is null */ - public static Bag transformedBag(Bag bag, Transformer transformer) { - return TransformedBag.decorate(bag, transformer); + public static Bag transformingBag(Bag bag, Transformer transformer) { + return TransformedBag.transformingBag(bag, transformer); } //----------------------------------------------------------------------- @@ -166,7 +166,7 @@ public class BagUtils { * @throws IllegalArgumentException if the SortedBag is null */ public static SortedBag synchronizedSortedBag(SortedBag bag) { - return SynchronizedSortedBag.decorate(bag); + return SynchronizedSortedBag.synchronizedSortedBag(bag); } /** @@ -180,7 +180,7 @@ public class BagUtils { * @throws IllegalArgumentException if the SortedBag is null */ public static SortedBag unmodifiableSortedBag(SortedBag bag) { - return UnmodifiableSortedBag.decorate(bag); + return UnmodifiableSortedBag.unmodifiableSortedBag(bag); } /** @@ -200,7 +200,7 @@ public class BagUtils { */ public static SortedBag predicatedSortedBag(SortedBag bag, Predicate predicate) { - return PredicatedSortedBag.decorate(bag, predicate); + return PredicatedSortedBag.predicatedSortedBag(bag, predicate); } /** @@ -211,15 +211,15 @@ public class BagUtils { * as it is a backdoor for adding untransformed objects. *

* Existing entries in the specified bag will not be transformed. - * If you want that behaviour, see {@link TransformedSortedBag#decorateTransform}. + * If you want that behaviour, see {@link TransformedSortedBag#transformedSortedBag(SortedBag, Transformer)}. * * @param bag the bag to predicate, must not be null * @param transformer the transformer for the bag, must not be null * @return a transformed bag backed by the given bag * @throws IllegalArgumentException if the Bag or Transformer is null */ - public static SortedBag transformedSortedBag(SortedBag bag, Transformer transformer) { - return TransformedSortedBag.decorate(bag, transformer); + public static SortedBag transformingSortedBag(SortedBag bag, Transformer transformer) { + return TransformedSortedBag.transformingSortedBag(bag, transformer); } /** diff --git a/src/java/org/apache/commons/collections/BufferUtils.java b/src/java/org/apache/commons/collections/BufferUtils.java index 3edf6f5e0..82f1332fd 100644 --- a/src/java/org/apache/commons/collections/BufferUtils.java +++ b/src/java/org/apache/commons/collections/BufferUtils.java @@ -37,7 +37,7 @@ public class BufferUtils { /** * An empty unmodifiable buffer. */ - public static final Buffer EMPTY_BUFFER = UnmodifiableBuffer.decorate(new ArrayStack(1)); + public static final Buffer EMPTY_BUFFER = UnmodifiableBuffer.unmodifiableBuffer(new ArrayStack(1)); /** * BufferUtils should not normally be instantiated. @@ -67,7 +67,7 @@ public class BufferUtils { * @throws IllegalArgumentException if the Buffer is null */ public static Buffer synchronizedBuffer(Buffer buffer) { - return SynchronizedBuffer.decorate(buffer); + return SynchronizedBuffer.synchronizedBuffer(buffer); } /** @@ -83,7 +83,7 @@ public class BufferUtils { * @throws IllegalArgumentException if the Buffer is null */ public static Buffer blockingBuffer(Buffer buffer) { - return BlockingBuffer.decorate(buffer); + return BlockingBuffer.blockingBuffer(buffer); } /** @@ -101,7 +101,7 @@ public class BufferUtils { * @since Commons Collections 3.2 */ public static Buffer blockingBuffer(Buffer buffer, long timeoutMillis) { - return BlockingBuffer.decorate(buffer, timeoutMillis); + return BlockingBuffer.blockingBuffer(buffer, timeoutMillis); } /** @@ -118,7 +118,7 @@ public class BufferUtils { * @since Commons Collections 3.2 */ public static Buffer boundedBuffer(Buffer buffer, int maximumSize) { - return BoundedBuffer.decorate(buffer, maximumSize); + return BoundedBuffer.boundedBuffer(buffer, maximumSize); } /** @@ -136,7 +136,7 @@ public class BufferUtils { * @since Commons Collections 3.2 */ public static Buffer boundedBuffer(Buffer buffer, int maximumSize, long timeoutMillis) { - return BoundedBuffer.decorate(buffer, maximumSize, timeoutMillis); + return BoundedBuffer.boundedBuffer(buffer, maximumSize, timeoutMillis); } /** @@ -147,7 +147,7 @@ public class BufferUtils { * @throws IllegalArgumentException if the Buffer is null */ public static Buffer unmodifiableBuffer(Buffer buffer) { - return UnmodifiableBuffer.decorate(buffer); + return UnmodifiableBuffer.unmodifiableBuffer(buffer); } /** @@ -164,7 +164,7 @@ public class BufferUtils { * @throws IllegalArgumentException if the Buffer or Predicate is null */ public static Buffer predicatedBuffer(Buffer buffer, Predicate predicate) { - return PredicatedBuffer.decorate(buffer, predicate); + return PredicatedBuffer.predicatedBuffer(buffer, predicate); } /** @@ -182,8 +182,8 @@ public class BufferUtils { * @return a transformed buffer backed by the given buffer * @throws IllegalArgumentException if the Buffer or Transformer is null */ - public static Buffer transformedBuffer(Buffer buffer, Transformer transformer) { - return TransformedBuffer.decorate(buffer, transformer); + public static Buffer transformingBuffer(Buffer buffer, Transformer transformer) { + return TransformedBuffer.transformingBuffer(buffer, transformer); } /** diff --git a/src/java/org/apache/commons/collections/ClosureUtils.java b/src/java/org/apache/commons/collections/ClosureUtils.java index 0b8aba183..08db91d2d 100644 --- a/src/java/org/apache/commons/collections/ClosureUtils.java +++ b/src/java/org/apache/commons/collections/ClosureUtils.java @@ -71,7 +71,7 @@ public class ClosureUtils { * @return the closure */ public static Closure exceptionClosure() { - return ExceptionClosure.getInstance(); + return ExceptionClosure.exceptionClosure(); } /** @@ -83,7 +83,7 @@ public class ClosureUtils { * @return the closure */ public static Closure nopClosure() { - return NOPClosure.getInstance(); + return NOPClosure.nopClosure(); } /** @@ -97,7 +97,7 @@ public class ClosureUtils { * @return the closure */ public static Closure asClosure(Transformer transformer) { - return TransformerClosure.getInstance(transformer); + return TransformerClosure.transformerClosure(transformer); } /** @@ -112,7 +112,7 @@ public class ClosureUtils { * @return the for closure */ public static Closure forClosure(int count, Closure closure) { - return ForClosure.getInstance(count, closure); + return ForClosure.forClosure(count, closure); } /** @@ -127,7 +127,7 @@ public class ClosureUtils { * @throws IllegalArgumentException if either argument is null */ public static Closure whileClosure(Predicate predicate, Closure closure) { - return WhileClosure.getInstance(predicate, closure, false); + return WhileClosure.whileClosure(predicate, closure, false); } /** @@ -142,7 +142,7 @@ public class ClosureUtils { * @throws IllegalArgumentException if either argument is null */ public static Closure doWhileClosure(Closure closure, Predicate predicate) { - return WhileClosure.getInstance(predicate, closure, true); + return WhileClosure.whileClosure(predicate, closure, true); } /** @@ -158,7 +158,7 @@ public class ClosureUtils { */ public static Closure invokerClosure(String methodName) { // reuse transformer as it has caching - this is lazy really, should have inner class here - return asClosure(InvokerTransformer.getInstance(methodName)); + return asClosure(InvokerTransformer.invokerTransformer(methodName)); } /** @@ -177,7 +177,7 @@ public class ClosureUtils { */ public static Closure invokerClosure(String methodName, Class[] paramTypes, Object[] args) { // reuse transformer as it has caching - this is lazy really, should have inner class here - return asClosure(InvokerTransformer.getInstance(methodName, paramTypes, args)); + return asClosure(InvokerTransformer.invokerTransformer(methodName, paramTypes, args)); } /** @@ -192,7 +192,7 @@ public class ClosureUtils { * @throws IllegalArgumentException if either closure is null */ public static Closure chainedClosure(Closure closure1, Closure closure2) { - return ChainedClosure.getInstance(closure1, closure2); + return ChainedClosure.chainedClosure(closure1, closure2); } /** @@ -207,7 +207,7 @@ public class ClosureUtils { * @throws IllegalArgumentException if any closure in the array is null */ public static Closure chainedClosure(Closure[] closures) { - return ChainedClosure.getInstance(closures); + return ChainedClosure.chainedClosure(closures); } /** @@ -224,7 +224,7 @@ public class ClosureUtils { * @throws IllegalArgumentException if any closure in the collection is null */ public static Closure chainedClosure(Collection> closures) { - return ChainedClosure.getInstance(closures); + return ChainedClosure.chainedClosure(closures); } /** @@ -241,7 +241,7 @@ public class ClosureUtils { * @since Commons Collections 3.2 */ public static Closure ifClosure(Predicate predicate, Closure trueClosure) { - return IfClosure.getInstance(predicate, trueClosure); + return IfClosure.ifClosure(predicate, trueClosure); } /** @@ -258,7 +258,7 @@ public class ClosureUtils { * @throws IllegalArgumentException if either closure is null */ public static Closure ifClosure(Predicate predicate, Closure trueClosure, Closure falseClosure) { - return IfClosure.getInstance(predicate, trueClosure, falseClosure); + return IfClosure.ifClosure(predicate, trueClosure, falseClosure); } /** @@ -279,7 +279,7 @@ public class ClosureUtils { * @throws IllegalArgumentException if the arrays are different sizes */ public static Closure switchClosure(Predicate[] predicates, Closure[] closures) { - return SwitchClosure.getInstance(predicates, closures, null); + return SwitchClosure.switchClosure(predicates, closures, null); } /** @@ -302,7 +302,7 @@ public class ClosureUtils { * @throws IllegalArgumentException if the arrays are different sizes */ public static Closure switchClosure(Predicate[] predicates, Closure[] closures, Closure defaultClosure) { - return SwitchClosure.getInstance(predicates, closures, defaultClosure); + return SwitchClosure.switchClosure(predicates, closures, defaultClosure); } /** @@ -326,7 +326,7 @@ public class ClosureUtils { * @throws ClassCastException if the map elements are of the wrong type */ public static Closure switchClosure(Map, Closure> predicatesAndClosures) { - return SwitchClosure.getInstance(predicatesAndClosures); + return SwitchClosure.switchClosure(predicatesAndClosures); } /** diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java index 08d770fee..d33c71177 100644 --- a/src/java/org/apache/commons/collections/CollectionUtils.java +++ b/src/java/org/apache/commons/collections/CollectionUtils.java @@ -128,7 +128,7 @@ public class CollectionUtils { * this purpose. However they could be cast to Set or List which might be * undesirable. This implementation only implements Collection. */ - public static final Collection EMPTY_COLLECTION = UnmodifiableCollection.decorate(new ArrayList()); + public static final Collection EMPTY_COLLECTION = UnmodifiableCollection.unmodifiableCollection(new ArrayList()); /** * CollectionUtils should not normally be instantiated. @@ -1167,7 +1167,7 @@ public class CollectionUtils { return ((BoundedCollection) coll).isFull(); } try { - BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing((Collection) coll); + BoundedCollection bcoll = UnmodifiableBoundedCollection.unmodifiableBoundedCollection((Collection) coll); return bcoll.isFull(); } catch (IllegalArgumentException ex) { return false; @@ -1198,7 +1198,7 @@ public class CollectionUtils { return ((BoundedCollection) coll).maxSize(); } try { - BoundedCollection bcoll = UnmodifiableBoundedCollection.decorateUsing((Collection) coll); + BoundedCollection bcoll = UnmodifiableBoundedCollection.unmodifiableBoundedCollection((Collection) coll); return bcoll.maxSize(); } catch (IllegalArgumentException ex) { return -1; @@ -1269,7 +1269,7 @@ public class CollectionUtils { * @throws IllegalArgumentException if the collection is null */ public static Collection synchronizedCollection(Collection collection) { - return SynchronizedCollection.decorate(collection); + return SynchronizedCollection.synchronizedCollection(collection); } /** @@ -1282,7 +1282,7 @@ public class CollectionUtils { * @throws IllegalArgumentException if the collection is null */ public static Collection unmodifiableCollection(Collection collection) { - return UnmodifiableCollection.decorate(collection); + return UnmodifiableCollection.unmodifiableCollection(collection); } /** @@ -1300,7 +1300,7 @@ public class CollectionUtils { * @throws IllegalArgumentException if the Collection is null */ public static Collection predicatedCollection(Collection collection, Predicate predicate) { - return PredicatedCollection.decorate(collection, predicate); + return PredicatedCollection.predicatedCollection(collection, predicate); } /** @@ -1318,8 +1318,8 @@ public class CollectionUtils { * @return a transformed collection backed by the given collection * @throws IllegalArgumentException if the Collection or Transformer is null */ - public static Collection transformedCollection(Collection collection, Transformer transformer) { - return TransformedCollection.decorate(collection, transformer); + public static Collection transformingCollection(Collection collection, Transformer transformer) { + return TransformedCollection.transformingCollection(collection, transformer); } /** diff --git a/src/java/org/apache/commons/collections/ComparatorUtils.java b/src/java/org/apache/commons/collections/ComparatorUtils.java index e04ae1248..3f058a7c8 100644 --- a/src/java/org/apache/commons/collections/ComparatorUtils.java +++ b/src/java/org/apache/commons/collections/ComparatorUtils.java @@ -55,7 +55,7 @@ public class ComparatorUtils { * @see ComparableComparator#getInstance */ @SuppressWarnings("unchecked") - public static final Comparator NATURAL_COMPARATOR = ComparableComparator.getInstance(); + public static final Comparator NATURAL_COMPARATOR = ComparableComparator.comparableComparator(); /** * Gets a comparator that uses the natural order of the objects. @@ -145,7 +145,7 @@ public class ComparatorUtils { * @return a comparator that sorts booleans */ public static Comparator booleanComparator(boolean trueFirst) { - return BooleanComparator.getBooleanComparator(trueFirst); + return BooleanComparator.booleanComparator(trueFirst); } /** diff --git a/src/java/org/apache/commons/collections/FactoryUtils.java b/src/java/org/apache/commons/collections/FactoryUtils.java index 85382f2fa..f80271c45 100644 --- a/src/java/org/apache/commons/collections/FactoryUtils.java +++ b/src/java/org/apache/commons/collections/FactoryUtils.java @@ -56,7 +56,7 @@ public class FactoryUtils { * @return the factory */ public static Factory exceptionFactory() { - return ExceptionFactory.getInstance(); + return ExceptionFactory.exceptionFactory(); } /** @@ -68,7 +68,7 @@ public class FactoryUtils { * @return the factory */ public static Factory nullFactory() { - return ConstantFactory.getInstance(null); + return ConstantFactory.constantFactory(null); } /** @@ -83,7 +83,7 @@ public class FactoryUtils { * @return the constant factory. */ public static Factory constantFactory(T constantToReturn) { - return ConstantFactory.getInstance(constantToReturn); + return ConstantFactory.constantFactory(constantToReturn); } /** @@ -104,7 +104,7 @@ public class FactoryUtils { * @throws IllegalArgumentException if the prototype cannot be cloned */ public static Factory prototypeFactory(T prototype) { - return PrototypeFactory.getInstance(prototype); + return PrototypeFactory.prototypeFactory(prototype); } /** @@ -118,7 +118,7 @@ public class FactoryUtils { * @throws IllegalArgumentException if the classToInstantiate is null */ public static Factory instantiateFactory(Class classToInstantiate) { - return InstantiateFactory.getInstance(classToInstantiate, null, null); + return InstantiateFactory.instantiateFactory(classToInstantiate, null, null); } /** @@ -136,7 +136,7 @@ public class FactoryUtils { * @throws IllegalArgumentException if the constructor doesn't exist */ public static Factory instantiateFactory(Class classToInstantiate, Class[] paramTypes, Object[] args) { - return InstantiateFactory.getInstance(classToInstantiate, paramTypes, args); + return InstantiateFactory.instantiateFactory(classToInstantiate, paramTypes, args); } } diff --git a/src/java/org/apache/commons/collections/IteratorUtils.java b/src/java/org/apache/commons/collections/IteratorUtils.java index 81da617a5..592d4a2f5 100644 --- a/src/java/org/apache/commons/collections/IteratorUtils.java +++ b/src/java/org/apache/commons/collections/IteratorUtils.java @@ -127,7 +127,7 @@ public class IteratorUtils { * @return an iterator over nothing */ public static ResettableIterator emptyIterator() { - return EmptyIterator.getResettableInstance(); + return EmptyIterator.resettableEmptyIterator(); } /** @@ -142,7 +142,7 @@ public class IteratorUtils { * @return a list iterator over nothing */ public static ResettableListIterator emptyListIterator() { - return EmptyListIterator.getResettableInstance(); + return EmptyListIterator.resettableEmptyListIterator(); } /** @@ -154,7 +154,7 @@ public class IteratorUtils { * @return an ordered iterator over nothing */ public static OrderedIterator emptyOrderedIterator() { - return EmptyOrderedIterator.getInstance(); + return EmptyOrderedIterator.emptyOrderedIterator(); } /** @@ -166,7 +166,7 @@ public class IteratorUtils { * @return a map iterator over nothing */ public static MapIterator emptyMapIterator() { - return EmptyMapIterator.getInstance(); + return EmptyMapIterator.emptyMapIterator(); } /** @@ -178,7 +178,7 @@ public class IteratorUtils { * @return a map iterator over nothing */ public static OrderedMapIterator emptyOrderedMapIterator() { - return EmptyOrderedMapIterator.getInstance(); + return EmptyOrderedMapIterator.emptyOrderedMapIterator(); } // Singleton @@ -417,7 +417,7 @@ public class IteratorUtils { * @return an immutable version of the iterator */ public static Iterator unmodifiableIterator(Iterator iterator) { - return UnmodifiableIterator.decorate(iterator); + return UnmodifiableIterator.unmodifiableIterator(iterator); } /** @@ -430,7 +430,7 @@ public class IteratorUtils { * @return an immutable version of the iterator */ public static ListIterator unmodifiableListIterator(ListIterator listIterator) { - return UnmodifiableListIterator.decorate(listIterator); + return UnmodifiableListIterator.umodifiableListIterator(listIterator); } /** @@ -442,7 +442,7 @@ public class IteratorUtils { * @return an immutable version of the iterator */ public static MapIterator unmodifiableMapIterator(MapIterator mapIterator) { - return UnmodifiableMapIterator.decorate(mapIterator); + return UnmodifiableMapIterator.unmodifiableMapIterator(mapIterator); } // Chained diff --git a/src/java/org/apache/commons/collections/ListUtils.java b/src/java/org/apache/commons/collections/ListUtils.java index 0ad4e2e44..ec515ef2e 100644 --- a/src/java/org/apache/commons/collections/ListUtils.java +++ b/src/java/org/apache/commons/collections/ListUtils.java @@ -299,7 +299,7 @@ public class ListUtils { * @throws IllegalArgumentException if the list is null */ public static List synchronizedList(List list) { - return SynchronizedList.decorate(list); + return SynchronizedList.synchronizedList(list); } /** @@ -312,7 +312,7 @@ public class ListUtils { * @throws IllegalArgumentException if the list is null */ public static List unmodifiableList(List list) { - return UnmodifiableList.decorate(list); + return UnmodifiableList.unmodifiableList(list); } /** @@ -329,7 +329,7 @@ public class ListUtils { * @throws IllegalArgumentException if the List or Predicate is null */ public static List predicatedList(List list, Predicate predicate) { - return PredicatedList.decorate(list, predicate); + return PredicatedList.predicatedList(list, predicate); } /** @@ -352,7 +352,7 @@ public class ListUtils { * @throws IllegalArgumentException if the List or Transformer is null */ public static List transformedList(List list, Transformer transformer) { - return TransformedList.decorate(list, transformer); + return TransformedList.transformingList(list, transformer); } /** @@ -385,7 +385,7 @@ public class ListUtils { * @throws IllegalArgumentException if the List or Factory is null */ public static List lazyList(List list, Factory factory) { - return LazyList.decorate(list, factory); + return LazyList.lazyList(list, factory); } /** @@ -399,7 +399,7 @@ public class ListUtils { * @throws IllegalArgumentException if the List is null */ public static List fixedSizeList(List list) { - return FixedSizeList.decorate(list); + return FixedSizeList.fixedSizeList(list); } /** diff --git a/src/java/org/apache/commons/collections/MapUtils.java b/src/java/org/apache/commons/collections/MapUtils.java index 238c68c62..42ee72650 100644 --- a/src/java/org/apache/commons/collections/MapUtils.java +++ b/src/java/org/apache/commons/collections/MapUtils.java @@ -92,13 +92,13 @@ public class MapUtils { * An empty unmodifiable map. * This was not provided in JDK1.2. */ - public static final Map EMPTY_MAP = UnmodifiableMap.decorate(new HashMap(1)); + public static final Map EMPTY_MAP = UnmodifiableMap.unmodifiableMap(new HashMap(1)); /** * An empty unmodifiable sorted map. * This is not provided in the JDK. */ - public static final SortedMap EMPTY_SORTED_MAP = UnmodifiableSortedMap.decorate(new TreeMap()); + public static final SortedMap EMPTY_SORTED_MAP = UnmodifiableSortedMap.unmodifiableSortedMap(new TreeMap()); /** * String used to indent the verbose and debug Map prints. @@ -1239,7 +1239,7 @@ public class MapUtils { * @throws IllegalArgumentException if the map is null */ public static Map unmodifiableMap(Map map) { - return UnmodifiableMap.decorate(map); + return UnmodifiableMap.unmodifiableMap(map); } /** @@ -1258,7 +1258,7 @@ public class MapUtils { * @throws IllegalArgumentException if the Map is null */ public static IterableMap predicatedMap(Map map, Predicate keyPred, Predicate valuePred) { - return PredicatedMap.decorate(map, keyPred, valuePred); + return PredicatedMap.predicatedMap(map, keyPred, valuePred); } /** @@ -1285,7 +1285,7 @@ public class MapUtils { public static IterableMap transformedMap(Map map, Transformer keyTransformer, Transformer valueTransformer) { - return TransformedMap.decorate(map, keyTransformer, valueTransformer); + return TransformedMap.transformingMap(map, keyTransformer, valueTransformer); } /** @@ -1299,7 +1299,7 @@ public class MapUtils { * @throws IllegalArgumentException if the Map is null */ public static IterableMap fixedSizeMap(Map map) { - return FixedSizeMap.decorate(map); + return FixedSizeMap.fixedSizeMap(map); } /** @@ -1331,7 +1331,7 @@ public class MapUtils { * @throws IllegalArgumentException if the Map or Factory is null */ public static IterableMap lazyMap(Map map, Factory factory) { - return LazyMap.getLazyMap(map, factory); + return LazyMap.lazyMap(map, factory); } /** @@ -1370,7 +1370,7 @@ public class MapUtils { * @throws IllegalArgumentException if the Map or Transformer is null */ public static IterableMap lazyMap(Map map, Transformer transformerFactory) { - return LazyMap.getLazyMap(map, transformerFactory); + return LazyMap.lazyMap(map, transformerFactory); } /** @@ -1385,7 +1385,7 @@ public class MapUtils { * @throws IllegalArgumentException if the Map is null */ public static OrderedMap orderedMap(Map map) { - return ListOrderedMap.decorate(map); + return ListOrderedMap.listOrderedMap(map); } /** @@ -1398,7 +1398,7 @@ public class MapUtils { * @since Commons Collections 3.2 */ public static MultiValueMap multiValueMap(Map> map) { - return MultiValueMap.decorate(map); + return MultiValueMap.multiValueMap(map); } /** @@ -1413,7 +1413,7 @@ public class MapUtils { * @since Commons Collections 3.2 */ public static > MultiValueMap multiValueMap(Map map, Class collectionClass) { - return MultiValueMap.decorate(map, collectionClass); + return MultiValueMap.multiValueMap(map, collectionClass); } /** @@ -1428,7 +1428,7 @@ public class MapUtils { * @since Commons Collections 3.2 */ public static > MultiValueMap multiValueMap(Map map, Factory collectionFactory) { - return MultiValueMap.decorate(map, collectionFactory); + return MultiValueMap.multiValueMap(map, collectionFactory); } // SortedMap decorators @@ -1470,7 +1470,7 @@ public class MapUtils { * @throws IllegalArgumentException if the map is null */ public static SortedMap unmodifiableSortedMap(SortedMap map) { - return UnmodifiableSortedMap.decorate(map); + return UnmodifiableSortedMap.unmodifiableSortedMap(map); } /** @@ -1490,7 +1490,7 @@ public class MapUtils { */ public static SortedMap predicatedSortedMap(SortedMap map, Predicate keyPred, Predicate valuePred) { - return PredicatedSortedMap.decorate(map, keyPred, valuePred); + return PredicatedSortedMap.predicatedSortedMap(map, keyPred, valuePred); } /** @@ -1517,7 +1517,7 @@ public class MapUtils { public static SortedMap transformedSortedMap(SortedMap map, Transformer keyTransformer, Transformer valueTransformer) { - return TransformedSortedMap.decorate(map, keyTransformer, valueTransformer); + return TransformedSortedMap.transformingSortedMap(map, keyTransformer, valueTransformer); } /** @@ -1531,7 +1531,7 @@ public class MapUtils { * @throws IllegalArgumentException if the SortedMap is null */ public static SortedMap fixedSizeSortedMap(SortedMap map) { - return FixedSizeSortedMap.decorate(map); + return FixedSizeSortedMap.fixedSizeSortedMap(map); } /** @@ -1565,7 +1565,7 @@ public class MapUtils { */ public static SortedMap lazySortedMap(SortedMap map, Factory factory) { - return LazySortedMap.getLazySortedMap(map, factory); + return LazySortedMap.lazySortedMap(map, factory); } /** @@ -1605,7 +1605,7 @@ public class MapUtils { */ public static SortedMap lazySortedMap(SortedMap map, Transformer transformerFactory) { - return LazySortedMap.getLazySortedMap(map, transformerFactory); + return LazySortedMap.lazySortedMap(map, transformerFactory); } /** diff --git a/src/java/org/apache/commons/collections/PredicateUtils.java b/src/java/org/apache/commons/collections/PredicateUtils.java index 7ef71ea0e..4abda33b1 100644 --- a/src/java/org/apache/commons/collections/PredicateUtils.java +++ b/src/java/org/apache/commons/collections/PredicateUtils.java @@ -21,7 +21,9 @@ import java.util.Collection; import org.apache.commons.collections.functors.AllPredicate; import org.apache.commons.collections.functors.AndPredicate; import org.apache.commons.collections.functors.AnyPredicate; +import org.apache.commons.collections.functors.EqualPredicate; import org.apache.commons.collections.functors.ExceptionPredicate; +import org.apache.commons.collections.functors.FalsePredicate; import org.apache.commons.collections.functors.IdentityPredicate; import org.apache.commons.collections.functors.InstanceofPredicate; import org.apache.commons.collections.functors.InvokerTransformer; @@ -31,10 +33,12 @@ import org.apache.commons.collections.functors.NotPredicate; import org.apache.commons.collections.functors.NullIsExceptionPredicate; import org.apache.commons.collections.functors.NullIsFalsePredicate; import org.apache.commons.collections.functors.NullIsTruePredicate; +import org.apache.commons.collections.functors.NullPredicate; import org.apache.commons.collections.functors.OnePredicate; import org.apache.commons.collections.functors.OrPredicate; import org.apache.commons.collections.functors.TransformedPredicate; import org.apache.commons.collections.functors.TransformerPredicate; +import org.apache.commons.collections.functors.TruePredicate; import org.apache.commons.collections.functors.UniquePredicate; /** @@ -89,7 +93,46 @@ public class PredicateUtils { * @return the predicate */ public static Predicate exceptionPredicate() { - return ExceptionPredicate.getInstance(); + return ExceptionPredicate.exceptionPredicate(); + } + + /** + * Gets a Predicate that always returns true. + * + * @see org.apache.commons.collections.functors.TruePredicate + * + * @return the predicate + * @deprecated use {@link TruePredicate#truePredicate()} instead. + */ + @Deprecated + public static Predicate truePredicate() { + return TruePredicate.truePredicate(); + } + + /** + * Gets a Predicate that always returns false. + * + * @see org.apache.commons.collections.functors.FalsePredicate + * + * @return the predicate + * @deprecated use {@link FalsePredicate#falsePredicate()} instead. + */ + @Deprecated + public static Predicate falsePredicate() { + return FalsePredicate. falsePredicate(); + } + + /** + * Gets a Predicate that checks if the input object passed in is null. + * + * @see org.apache.commons.collections.functors.NullPredicate + * + * @return the predicate + * @deprecated use {@link NullPredicate#nullPredicate()} instead + */ + @Deprecated + public static Predicate nullPredicate() { + return NullPredicate.nullPredicate(); } /** @@ -100,7 +143,22 @@ public class PredicateUtils { * @return the predicate */ public static Predicate notNullPredicate() { - return NotNullPredicate.getInstance(); + return NotNullPredicate.notNullPredicate(); + } + + /** + * Creates a Predicate that checks if the input object is equal to the + * specified object using equals(). + * + * @see org.apache.commons.collections.functors.EqualPredicate + * + * @param value the value to compare against + * @return the predicate + * @deprecated use {@link EqualPredicate#equalPredicate(Object)} instead. + */ + @Deprecated + public static Predicate equalPredicate(T value) { + return EqualPredicate.equalPredicate(value); } /** @@ -113,7 +171,7 @@ public class PredicateUtils { * @return the predicate */ public static Predicate identityPredicate(T value) { - return IdentityPredicate.getInstance(value); + return IdentityPredicate.identityPredicate(value); } /** @@ -128,7 +186,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if the class is null */ public static Predicate instanceofPredicate(Class type) { - return InstanceofPredicate.getInstance(type); + return InstanceofPredicate.instanceOfPredicate(type); } /** @@ -144,7 +202,7 @@ public class PredicateUtils { */ public static Predicate uniquePredicate() { // must return new instance each time - return UniquePredicate.getInstance(); + return UniquePredicate.uniquePredicate(); } /** @@ -166,7 +224,7 @@ public class PredicateUtils { */ public static Predicate invokerPredicate(String methodName){ // reuse transformer as it has caching - this is lazy really, should have inner class here - return asPredicate(InvokerTransformer.getInstance(methodName)); + return asPredicate(InvokerTransformer.invokerTransformer(methodName)); } /** @@ -191,7 +249,7 @@ public class PredicateUtils { */ public static Predicate invokerPredicate(String methodName, Class[] paramTypes, Object[] args){ // reuse transformer as it has caching - this is lazy really, should have inner class here - return asPredicate(InvokerTransformer.getInstance(methodName, paramTypes, args)); + return asPredicate(InvokerTransformer.invokerTransformer(methodName, paramTypes, args)); } // Boolean combinations @@ -209,7 +267,25 @@ public class PredicateUtils { * @throws IllegalArgumentException if either predicate is null */ public static Predicate andPredicate(Predicate predicate1, Predicate predicate2) { - return AndPredicate.getInstance(predicate1, predicate2); + return AndPredicate.andPredicate(predicate1, predicate2); + } + + /** + * Create a new Predicate that returns true only if all of the specified + * predicates are true. + * If the array of predicates is empty, then this predicate returns true. + * + * @see org.apache.commons.collections.functors.AllPredicate + * + * @param predicates an array of predicates to check, may not be null + * @return the all predicate + * @throws IllegalArgumentException if the predicates array is null + * @throws IllegalArgumentException if any predicate in the array is null + * @deprecated use {@link AllPredicate#allPredicate(Predicate...)} instead. + */ + @Deprecated + public static Predicate allPredicate(Predicate[] predicates) { + return AllPredicate.allPredicate(predicates); } /** @@ -240,7 +316,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if either predicate is null */ public static Predicate orPredicate(Predicate predicate1, Predicate predicate2) { - return OrPredicate.getInstance(predicate1, predicate2); + return OrPredicate.orPredicate(predicate1, predicate2); } /** @@ -256,7 +332,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if any predicate in the array is null */ public static Predicate anyPredicate(Predicate[] predicates) { - return AnyPredicate.getInstance(predicates); + return AnyPredicate.anyPredicate(predicates); } /** @@ -272,7 +348,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if any predicate in the collection is null */ public static Predicate anyPredicate(Collection> predicates) { - return AnyPredicate.getInstance(predicates); + return AnyPredicate.anyPredicate(predicates); } /** @@ -304,7 +380,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if any predicate in the array is null */ public static Predicate onePredicate(Predicate[] predicates) { - return OnePredicate.getInstance(predicates); + return OnePredicate.onePredicate(predicates); } /** @@ -320,7 +396,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if any predicate in the collection is null */ public static Predicate onePredicate(Collection> predicates) { - return OnePredicate.getInstance(predicates); + return OnePredicate.onePredicate(predicates); } /** @@ -352,7 +428,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if any predicate in the array is null */ public static Predicate nonePredicate(Predicate[] predicates) { - return NonePredicate.getInstance(predicates); + return NonePredicate.nonePredicate(predicates); } /** @@ -368,7 +444,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if any predicate in the collection is null */ public static Predicate nonePredicate(Collection> predicates) { - return NonePredicate.getInstance(predicates); + return NonePredicate.nonePredicate(predicates); } /** @@ -382,7 +458,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if the predicate is null */ public static Predicate notPredicate(Predicate predicate) { - return NotPredicate.getInstance(predicate); + return NotPredicate.notPredicate(predicate); } // Adaptors @@ -400,7 +476,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if the transformer is null */ public static Predicate asPredicate(Transformer transformer) { - return TransformerPredicate.getInstance(transformer); + return TransformerPredicate.transformerPredicate(transformer); } // Null handlers @@ -418,7 +494,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if the predicate is null. */ public static Predicate nullIsExceptionPredicate(Predicate predicate){ - return NullIsExceptionPredicate.getInstance(predicate); + return NullIsExceptionPredicate.nullIsExceptionPredicate(predicate); } /** @@ -433,7 +509,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if the predicate is null. */ public static Predicate nullIsFalsePredicate(Predicate predicate){ - return NullIsFalsePredicate.getInstance(predicate); + return NullIsFalsePredicate.nullIsFalsePredicate(predicate); } /** @@ -448,7 +524,7 @@ public class PredicateUtils { * @throws IllegalArgumentException if the predicate is null. */ public static Predicate nullIsTruePredicate(Predicate predicate){ - return NullIsTruePredicate.getInstance(predicate); + return NullIsTruePredicate.nullIsTruePredicate(predicate); } // Transformed @@ -467,7 +543,7 @@ public class PredicateUtils { */ public static Predicate transformedPredicate( Transformer transformer, Predicate predicate) { - return TransformedPredicate.getInstance(transformer, predicate); + return TransformedPredicate.transformedPredicate(transformer, predicate); } } diff --git a/src/java/org/apache/commons/collections/SetUtils.java b/src/java/org/apache/commons/collections/SetUtils.java index f0cf5b39e..4ff60ecd2 100644 --- a/src/java/org/apache/commons/collections/SetUtils.java +++ b/src/java/org/apache/commons/collections/SetUtils.java @@ -66,7 +66,7 @@ public class SetUtils { * An empty unmodifiable sorted set. * This is not provided in the JDK. */ - public static final SortedSet EMPTY_SORTED_SET = UnmodifiableSortedSet.decorate(new TreeSet()); + public static final SortedSet EMPTY_SORTED_SET = UnmodifiableSortedSet.unmodifiableSortedSet(new TreeSet()); /** * Get a typed empty unmodifiable sorted set. @@ -174,7 +174,7 @@ public class SetUtils { * @throws IllegalArgumentException if the set is null */ public static Set synchronizedSet(Set set) { - return SynchronizedSet.decorate(set); + return SynchronizedSet.synchronizedSet(set); } /** @@ -187,7 +187,7 @@ public class SetUtils { * @throws IllegalArgumentException if the set is null */ public static Set unmodifiableSet(Set set) { - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } /** @@ -204,7 +204,7 @@ public class SetUtils { * @throws IllegalArgumentException if the Set or Predicate is null */ public static Set predicatedSet(Set set, Predicate predicate) { - return PredicatedSet.decorate(set, predicate); + return PredicatedSet.predicatedSet(set, predicate); } /** @@ -223,7 +223,7 @@ public class SetUtils { * @throws IllegalArgumentException if the Set or Transformer is null */ public static Set transformedSet(Set set, Transformer transformer) { - return TransformedSet.decorate(set, transformer); + return TransformedSet.transformingSet(set, transformer); } /** @@ -238,7 +238,7 @@ public class SetUtils { * @throws IllegalArgumentException if the Set is null */ public static Set orderedSet(Set set) { - return ListOrderedSet.decorate(set); + return ListOrderedSet.listOrderedSet(set); } //----------------------------------------------------------------------- @@ -265,7 +265,7 @@ public class SetUtils { * @throws IllegalArgumentException if the set is null */ public static SortedSet synchronizedSortedSet(SortedSet set) { - return SynchronizedSortedSet.decorate(set); + return SynchronizedSortedSet.synchronizedSortedSet(set); } /** @@ -278,7 +278,7 @@ public class SetUtils { * @throws IllegalArgumentException if the set is null */ public static SortedSet unmodifiableSortedSet(SortedSet set) { - return UnmodifiableSortedSet.decorate(set); + return UnmodifiableSortedSet.unmodifiableSortedSet(set); } /** @@ -295,7 +295,7 @@ public class SetUtils { * @throws IllegalArgumentException if the Set or Predicate is null */ public static SortedSet predicatedSortedSet(SortedSet set, Predicate predicate) { - return PredicatedSortedSet.decorate(set, predicate); + return PredicatedSortedSet.predicatedSortedSet(set, predicate); } /** @@ -314,7 +314,7 @@ public class SetUtils { * @throws IllegalArgumentException if the Set or Transformer is null */ public static SortedSet transformedSortedSet(SortedSet set, Transformer transformer) { - return TransformedSortedSet.decorate(set, transformer); + return TransformedSortedSet.transformingSortedSet(set, transformer); } } diff --git a/src/java/org/apache/commons/collections/TransformerUtils.java b/src/java/org/apache/commons/collections/TransformerUtils.java index 9ba91f190..59866f065 100644 --- a/src/java/org/apache/commons/collections/TransformerUtils.java +++ b/src/java/org/apache/commons/collections/TransformerUtils.java @@ -80,7 +80,7 @@ public class TransformerUtils { * @return the transformer */ public static Transformer exceptionTransformer() { - return ExceptionTransformer.getInstance(); + return ExceptionTransformer.exceptionTransformer(); } /** @@ -91,7 +91,7 @@ public class TransformerUtils { * @return the transformer */ public static Transformer nullTransformer() { - return ConstantTransformer.getNullInstance(); + return ConstantTransformer.nullTransformer(); } /** @@ -104,7 +104,7 @@ public class TransformerUtils { * @return the transformer */ public static Transformer nopTransformer() { - return NOPTransformer.getInstance(); + return NOPTransformer.nopTransformer(); } /** @@ -122,7 +122,7 @@ public class TransformerUtils { * @return the transformer */ public static Transformer cloneTransformer() { - return CloneTransformer.getInstance(); + return CloneTransformer.cloneTransformer(); } /** @@ -135,7 +135,7 @@ public class TransformerUtils { * @return the transformer. */ public static Transformer constantTransformer(O constantToReturn) { - return ConstantTransformer.getInstance(constantToReturn); + return ConstantTransformer.constantTransformer(constantToReturn); } /** @@ -149,7 +149,7 @@ public class TransformerUtils { * @throws IllegalArgumentException if the closure is null */ public static Transformer asTransformer(Closure closure) { - return ClosureTransformer.getInstance(closure); + return ClosureTransformer.closureTransformer(closure); } /** @@ -163,7 +163,7 @@ public class TransformerUtils { * @throws IllegalArgumentException if the predicate is null */ public static Transformer asTransformer(Predicate predicate) { - return PredicateTransformer.getInstance(predicate); + return PredicateTransformer.predicateTransformer(predicate); } /** @@ -177,7 +177,7 @@ public class TransformerUtils { * @throws IllegalArgumentException if the factory is null */ public static Transformer asTransformer(Factory factory) { - return FactoryTransformer.getInstance(factory); + return FactoryTransformer.factoryTransformer(factory); } /** @@ -191,10 +191,11 @@ public class TransformerUtils { * @return the transformer * @throws IllegalArgumentException if either transformer is null */ - public static Transformer chainedTransformer( + @SuppressWarnings("unchecked") + public static Transformer chainedTransformer( Transformer transformer1, Transformer transformer2) { - return ChainedTransformer.getInstance(transformer1, transformer2); + return ChainedTransformer. chainedTransformer(transformer1, transformer2); } /** @@ -209,7 +210,7 @@ public class TransformerUtils { * @throws IllegalArgumentException if any transformer in the array is null */ public static Transformer chainedTransformer(Transformer[] transformers) { - return ChainedTransformer.getInstance(transformers); + return ChainedTransformer.chainedTransformer(transformers); } /** @@ -226,7 +227,7 @@ public class TransformerUtils { */ public static Transformer chainedTransformer( Collection> transformers) { - return ChainedTransformer.getInstance(transformers); + return ChainedTransformer.chainedTransformer(transformers); } /** @@ -246,7 +247,7 @@ public class TransformerUtils { public static Transformer switchTransformer(Predicate predicate, Transformer trueTransformer, Transformer falseTransformer) { - return SwitchTransformer.getInstance(new Predicate[] { predicate }, + return SwitchTransformer.switchTransformer(new Predicate[] { predicate }, new Transformer[] { trueTransformer }, falseTransformer); } @@ -268,7 +269,7 @@ public class TransformerUtils { */ public static Transformer switchTransformer(Predicate[] predicates, Transformer[] transformers) { - return SwitchTransformer.getInstance(predicates, transformers, null); + return SwitchTransformer.switchTransformer(predicates, transformers, null); } /** @@ -292,7 +293,7 @@ public class TransformerUtils { public static Transformer switchTransformer(Predicate[] predicates, Transformer[] transformers, Transformer defaultTransformer) { - return SwitchTransformer.getInstance(predicates, transformers, defaultTransformer); + return SwitchTransformer.switchTransformer(predicates, transformers, defaultTransformer); } /** @@ -318,7 +319,7 @@ public class TransformerUtils { */ public static Transformer switchTransformer( Map, Transformer> predicatesAndTransformers) { - return SwitchTransformer.getInstance(predicatesAndTransformers); + return SwitchTransformer.switchTransformer(predicatesAndTransformers); } /** @@ -365,7 +366,7 @@ public class TransformerUtils { * @return the transformer */ public static Transformer, T> instantiateTransformer() { - return InstantiateTransformer.getInstance(); + return InstantiateTransformer.instantiateTransformer(); } /** @@ -382,7 +383,7 @@ public class TransformerUtils { */ public static Transformer, T> instantiateTransformer( Class[] paramTypes, Object[] args) { - return InstantiateTransformer.getInstance(paramTypes, args); + return InstantiateTransformer.instantiateTransformer(paramTypes, args); } /** @@ -396,7 +397,7 @@ public class TransformerUtils { * @throws IllegalArgumentException if the map is null */ public static Transformer mapTransformer(Map map) { - return MapTransformer.getInstance(map); + return MapTransformer.mapTransformer(map); } /** @@ -415,7 +416,7 @@ public class TransformerUtils { * @throws IllegalArgumentException if the methodName is null. */ public static Transformer invokerTransformer(String methodName){ - return InvokerTransformer.getInstance(methodName, null, null); + return InvokerTransformer.invokerTransformer(methodName, null, null); } /** @@ -433,7 +434,7 @@ public class TransformerUtils { * @throws IllegalArgumentException if the paramTypes and args don't match */ public static Transformer invokerTransformer(String methodName, Class[] paramTypes, Object[] args){ - return InvokerTransformer.getInstance(methodName, paramTypes, args); + return InvokerTransformer.invokerTransformer(methodName, paramTypes, args); } /** @@ -446,7 +447,7 @@ public class TransformerUtils { * @return the transformer */ public static Transformer stringValueTransformer() { - return StringValueTransformer.getInstance(); + return StringValueTransformer.stringValueTransformer(); } } diff --git a/src/java/org/apache/commons/collections/bag/AbstractMapBag.java b/src/java/org/apache/commons/collections/bag/AbstractMapBag.java index e63ac9963..f568f266c 100644 --- a/src/java/org/apache/commons/collections/bag/AbstractMapBag.java +++ b/src/java/org/apache/commons/collections/bag/AbstractMapBag.java @@ -482,7 +482,7 @@ public abstract class AbstractMapBag implements Bag { */ public Set uniqueSet() { if (uniqueSet == null) { - uniqueSet = UnmodifiableSet. decorate(map.keySet()); + uniqueSet = UnmodifiableSet. unmodifiableSet(map.keySet()); } return uniqueSet; } diff --git a/src/java/org/apache/commons/collections/bag/PredicatedBag.java b/src/java/org/apache/commons/collections/bag/PredicatedBag.java index e1e1def29..097fa0489 100644 --- a/src/java/org/apache/commons/collections/bag/PredicatedBag.java +++ b/src/java/org/apache/commons/collections/bag/PredicatedBag.java @@ -59,7 +59,7 @@ public class PredicatedBag * @throws IllegalArgumentException if bag or predicate is null * @throws IllegalArgumentException if the bag contains invalid elements */ - public static Bag decorate(Bag bag, Predicate predicate) { + public static Bag predicatedBag(Bag bag, Predicate predicate) { return new PredicatedBag(bag, predicate); } diff --git a/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java b/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java index c609e75f4..9600218f2 100644 --- a/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java +++ b/src/java/org/apache/commons/collections/bag/PredicatedSortedBag.java @@ -58,7 +58,7 @@ public class PredicatedSortedBag * @throws IllegalArgumentException if bag or predicate is null * @throws IllegalArgumentException if the bag contains invalid elements */ - public static SortedBag decorate(SortedBag bag, Predicate predicate) { + public static SortedBag predicatedSortedBag(SortedBag bag, Predicate predicate) { return new PredicatedSortedBag(bag, predicate); } diff --git a/src/java/org/apache/commons/collections/bag/SynchronizedBag.java b/src/java/org/apache/commons/collections/bag/SynchronizedBag.java index 1df1cf588..6454220c1 100644 --- a/src/java/org/apache/commons/collections/bag/SynchronizedBag.java +++ b/src/java/org/apache/commons/collections/bag/SynchronizedBag.java @@ -49,7 +49,7 @@ public class SynchronizedBag * @return a new synchronized Bag * @throws IllegalArgumentException if bag is null */ - public static Bag decorate(Bag bag) { + public static Bag synchronizedBag(Bag bag) { return new SynchronizedBag(bag); } diff --git a/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java b/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java index 394050fad..464131d46 100644 --- a/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java +++ b/src/java/org/apache/commons/collections/bag/SynchronizedSortedBag.java @@ -48,7 +48,7 @@ public class SynchronizedSortedBag * @return a new synchronized SortedBag * @throws IllegalArgumentException if bag is null */ - public static SortedBag decorate(SortedBag bag) { + public static SortedBag synchronizedSortedBag(SortedBag bag) { return new SynchronizedSortedBag(bag); } diff --git a/src/java/org/apache/commons/collections/bag/TransformedBag.java b/src/java/org/apache/commons/collections/bag/TransformedBag.java index 6ee203d10..85ec0348f 100644 --- a/src/java/org/apache/commons/collections/bag/TransformedBag.java +++ b/src/java/org/apache/commons/collections/bag/TransformedBag.java @@ -49,14 +49,14 @@ public class TransformedBag *

* If there are any elements already in the bag being decorated, they * are NOT transformed. - * Constrast this with {@link #decorateTransform}. + * Contrast this with {@link #transformedBag(Bag, Transformer)}. * * @param bag the bag to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @return a new transformed Bag * @throws IllegalArgumentException if bag or transformer is null */ - public static Bag decorate(Bag bag, Transformer transformer) { + public static Bag transformingBag(Bag bag, Transformer transformer) { return new TransformedBag(bag, transformer); } @@ -66,7 +66,7 @@ public class TransformedBag *

* If there are any elements already in the bag being decorated, they * will be transformed by this method. - * Constrast this with {@link #decorate}. + * Contrast this with {@link #transformingBag(Bag, Transformer)}. * * @param bag the bag to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null @@ -74,13 +74,13 @@ public class TransformedBag * @throws IllegalArgumentException if bag or transformer is null * @since Commons Collections 3.3 */ - public static Bag decorateTransform(Bag bag, Transformer transformer) { + public static Bag transformedBag(Bag bag, Transformer transformer) { TransformedBag decorated = new TransformedBag(bag, transformer); if (transformer != null && bag != null && bag.size() > 0) { @SuppressWarnings("unchecked") // Bag is of type E E[] values = (E[]) bag.toArray(); bag.clear(); - for(int i=0; i public Set uniqueSet() { Set set = getBag().uniqueSet(); - return TransformedSet.decorate(set, transformer); + return TransformedSet.transformingSet(set, transformer); } } diff --git a/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java b/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java index 8d5492994..0b47e17f9 100644 --- a/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java +++ b/src/java/org/apache/commons/collections/bag/TransformedSortedBag.java @@ -47,14 +47,14 @@ public class TransformedSortedBag *

* If there are any elements already in the bag being decorated, they * are NOT transformed. - * Constrast this with {@link #decorateTransform}. + * Contrast this with {@link #transformedSortedBag(SortedBag, Transformer)}. * * @param bag the bag to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @return a new transformed SortedBag * @throws IllegalArgumentException if bag or transformer is null */ - public static SortedBag decorate(SortedBag bag, Transformer transformer) { + public static SortedBag transformingSortedBag(SortedBag bag, Transformer transformer) { return new TransformedSortedBag(bag, transformer); } @@ -64,7 +64,7 @@ public class TransformedSortedBag *

* If there are any elements already in the bag being decorated, they * will be transformed by this method. - * Constrast this with {@link #decorate}. + * Contrast this with {@link #transformingSortedBag(SortedBag, Transformer)}. * * @param bag the bag to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null @@ -72,7 +72,7 @@ public class TransformedSortedBag * @throws IllegalArgumentException if bag or transformer is null * @since Commons Collections 3.3 */ - public static SortedBag decorateTransform(SortedBag bag, Transformer transformer) { + public static SortedBag transformedSortedBag(SortedBag bag, Transformer transformer) { TransformedSortedBag decorated = new TransformedSortedBag(bag, transformer); if (transformer != null && bag != null && bag.size() > 0) { @SuppressWarnings("unchecked") // bag is type E diff --git a/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java b/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java index 60de96175..06b7d577f 100644 --- a/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java +++ b/src/java/org/apache/commons/collections/bag/UnmodifiableBag.java @@ -56,7 +56,7 @@ public final class UnmodifiableBag * @return an unmodifiable Bag * @throws IllegalArgumentException if bag is null */ - public static Bag decorate(Bag bag) { + public static Bag unmodifiableBag(Bag bag) { if (bag instanceof Unmodifiable) { return bag; } @@ -102,7 +102,8 @@ public final class UnmodifiableBag //----------------------------------------------------------------------- @Override public Iterator iterator() { - return UnmodifiableIterator.decorate(decorated().iterator()); + return UnmodifiableIterator. unmodifiableIterator(decorated() + .iterator()); } @Override @@ -149,7 +150,7 @@ public final class UnmodifiableBag @Override public Set uniqueSet() { Set set = decorated().uniqueSet(); - return UnmodifiableSet.decorate(set); + return UnmodifiableSet. unmodifiableSet(set); } } diff --git a/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java b/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java index 1c812bbcc..35c4a8d7a 100644 --- a/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java +++ b/src/java/org/apache/commons/collections/bag/UnmodifiableSortedBag.java @@ -56,7 +56,7 @@ public final class UnmodifiableSortedBag * @return an unmodifiable SortedBag * @throws IllegalArgumentException if bag is null */ - public static SortedBag decorate(SortedBag bag) { + public static SortedBag unmodifiableSortedBag(SortedBag bag) { if (bag instanceof Unmodifiable) { return bag; } @@ -102,7 +102,7 @@ public final class UnmodifiableSortedBag //----------------------------------------------------------------------- @Override public Iterator iterator() { - return UnmodifiableIterator.decorate(decorated().iterator()); + return UnmodifiableIterator.unmodifiableIterator(decorated().iterator()); } @Override @@ -149,7 +149,7 @@ public final class UnmodifiableSortedBag @Override public Set uniqueSet() { Set set = decorated().uniqueSet(); - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } } diff --git a/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java b/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java index f583f50e4..82c1bd9c2 100644 --- a/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java +++ b/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java @@ -422,7 +422,7 @@ public class TreeBidiMap, V extends Comparable> imple */ public OrderedMapIterator mapIterator() { if (isEmpty()) { - return EmptyOrderedMapIterator.getInstance(); + return EmptyOrderedMapIterator.emptyOrderedMapIterator(); } return new ViewMapIterator(KEY); } @@ -2110,7 +2110,7 @@ public class TreeBidiMap, V extends Comparable> imple public OrderedMapIterator mapIterator() { if (isEmpty()) { - return EmptyOrderedMapIterator.getInstance(); + return EmptyOrderedMapIterator.emptyOrderedMapIterator(); } return new InverseViewMapIterator(VALUE); } diff --git a/src/java/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java b/src/java/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java index f64086a8b..274a9aaba 100644 --- a/src/java/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java +++ b/src/java/org/apache/commons/collections/bidimap/UnmodifiableBidiMap.java @@ -53,7 +53,7 @@ public final class UnmodifiableBidiMap * @return an unmodifiable BidiMap * @throws IllegalArgumentException if map is null */ - public static BidiMap decorate(BidiMap map) { + public static BidiMap unmodifiableBidiMap(BidiMap map) { if (map instanceof Unmodifiable) { return map; } @@ -95,19 +95,19 @@ public final class UnmodifiableBidiMap @Override public Set> entrySet() { Set> set = super.entrySet(); - return UnmodifiableEntrySet.decorate(set); + return UnmodifiableEntrySet.unmodifiableEntrySet(set); } @Override public Set keySet() { Set set = super.keySet(); - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } @Override public Collection values() { Collection coll = super.values(); - return UnmodifiableCollection.decorate(coll); + return UnmodifiableCollection.unmodifiableCollection(coll); } //----------------------------------------------------------------------- @@ -119,7 +119,7 @@ public final class UnmodifiableBidiMap @Override public MapIterator mapIterator() { MapIterator it = decorated().mapIterator(); - return UnmodifiableMapIterator.decorate(it); + return UnmodifiableMapIterator.unmodifiableMapIterator(it); } @Override diff --git a/src/java/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java b/src/java/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java index 6b8f0b3b1..691481ce9 100644 --- a/src/java/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java +++ b/src/java/org/apache/commons/collections/bidimap/UnmodifiableOrderedBidiMap.java @@ -53,7 +53,7 @@ public final class UnmodifiableOrderedBidiMap * @return an unmodifiable OrderedBidiMap * @throws IllegalArgumentException if map is null */ - public static OrderedBidiMap decorate(OrderedBidiMap map) { + public static OrderedBidiMap unmodifiableOrderedBidiMap(OrderedBidiMap map) { if (map instanceof Unmodifiable) { return map; } @@ -95,19 +95,19 @@ public final class UnmodifiableOrderedBidiMap @Override public Set> entrySet() { Set> set = super.entrySet(); - return UnmodifiableEntrySet.decorate(set); + return UnmodifiableEntrySet.unmodifiableEntrySet(set); } @Override public Set keySet() { Set set = super.keySet(); - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } @Override public Collection values() { Collection coll = super.values(); - return UnmodifiableCollection.decorate(coll); + return UnmodifiableCollection.unmodifiableCollection(coll); } //----------------------------------------------------------------------- @@ -125,7 +125,7 @@ public final class UnmodifiableOrderedBidiMap @Override public OrderedMapIterator mapIterator() { OrderedMapIterator it = decorated().mapIterator(); - return UnmodifiableOrderedMapIterator.decorate(it); + return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it); } public OrderedBidiMap inverseOrderedBidiMap() { diff --git a/src/java/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java b/src/java/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java index 79276be75..14b785fef 100644 --- a/src/java/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java +++ b/src/java/org/apache/commons/collections/bidimap/UnmodifiableSortedBidiMap.java @@ -55,7 +55,7 @@ public final class UnmodifiableSortedBidiMap * @return an unmodifiable SortedBidiMap * @throws IllegalArgumentException if map is null */ - public static SortedBidiMap decorate(SortedBidiMap map) { + public static SortedBidiMap unmodifiableSortedBidiMap(SortedBidiMap map) { if (map instanceof Unmodifiable) { return map; } @@ -97,19 +97,19 @@ public final class UnmodifiableSortedBidiMap @Override public Set> entrySet() { Set> set = super.entrySet(); - return UnmodifiableEntrySet.decorate(set); + return UnmodifiableEntrySet.unmodifiableEntrySet(set); } @Override public Set keySet() { Set set = super.keySet(); - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } @Override public Collection values() { Collection coll = super.values(); - return UnmodifiableCollection.decorate(coll); + return UnmodifiableCollection.unmodifiableCollection(coll); } //----------------------------------------------------------------------- @@ -122,7 +122,7 @@ public final class UnmodifiableSortedBidiMap @Override public OrderedMapIterator mapIterator() { OrderedMapIterator it = decorated().mapIterator(); - return UnmodifiableOrderedMapIterator.decorate(it); + return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it); } //----------------------------------------------------------------------- @@ -138,19 +138,19 @@ public final class UnmodifiableSortedBidiMap @Override public SortedMap subMap(K fromKey, K toKey) { SortedMap sm = decorated().subMap(fromKey, toKey); - return UnmodifiableSortedMap.decorate(sm); + return UnmodifiableSortedMap.unmodifiableSortedMap(sm); } @Override public SortedMap headMap(K toKey) { SortedMap sm = decorated().headMap(toKey); - return UnmodifiableSortedMap.decorate(sm); + return UnmodifiableSortedMap.unmodifiableSortedMap(sm); } @Override public SortedMap tailMap(K fromKey) { SortedMap sm = decorated().tailMap(fromKey); - return UnmodifiableSortedMap.decorate(sm); + return UnmodifiableSortedMap.unmodifiableSortedMap(sm); } } diff --git a/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java b/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java index 6381c4c28..4fffca3eb 100644 --- a/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java +++ b/src/java/org/apache/commons/collections/buffer/BlockingBuffer.java @@ -64,7 +64,7 @@ public class BlockingBuffer extends SynchronizedBuffer { * @return a new blocking Buffer * @throws IllegalArgumentException if buffer is null */ - public static Buffer decorate(Buffer buffer) { + public static Buffer blockingBuffer(Buffer buffer) { return new BlockingBuffer(buffer); } @@ -77,7 +77,7 @@ public class BlockingBuffer extends SynchronizedBuffer { * @throws IllegalArgumentException if the buffer is null * @since Commons Collections 3.2 */ - public static Buffer decorate(Buffer buffer, long timeoutMillis) { + public static Buffer blockingBuffer(Buffer buffer, long timeoutMillis) { return new BlockingBuffer(buffer, timeoutMillis); } diff --git a/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java b/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java index 92c1955b4..304e0f19c 100644 --- a/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java +++ b/src/java/org/apache/commons/collections/buffer/BoundedBuffer.java @@ -67,7 +67,7 @@ public class BoundedBuffer extends SynchronizedBuffer implements BoundedCo * @throws IllegalArgumentException if the buffer is null * @throws IllegalArgumentException if the maximum size is zero or less */ - public static BoundedBuffer decorate(Buffer buffer, int maximumSize) { + public static BoundedBuffer boundedBuffer(Buffer buffer, int maximumSize) { return new BoundedBuffer(buffer, maximumSize, 0L); } @@ -82,7 +82,7 @@ public class BoundedBuffer extends SynchronizedBuffer implements BoundedCo * @throws IllegalArgumentException if the buffer is null * @throws IllegalArgumentException if the maximum size is zero or less */ - public static BoundedBuffer decorate(Buffer buffer, int maximumSize, long timeout) { + public static BoundedBuffer boundedBuffer(Buffer buffer, int maximumSize, long timeout) { return new BoundedBuffer(buffer, maximumSize, timeout); } diff --git a/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java b/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java index a8172c7ff..9b8ec7fb2 100644 --- a/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java +++ b/src/java/org/apache/commons/collections/buffer/PredicatedBuffer.java @@ -56,7 +56,7 @@ public class PredicatedBuffer extends PredicatedCollection implements Buff * @throws IllegalArgumentException if buffer or predicate is null * @throws IllegalArgumentException if the buffer contains invalid elements */ - public static Buffer decorate(Buffer buffer, Predicate predicate) { + public static Buffer predicatedBuffer(Buffer buffer, Predicate predicate) { return new PredicatedBuffer(buffer, predicate); } diff --git a/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java b/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java index d0a14bffd..a01829cd0 100644 --- a/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java +++ b/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java @@ -45,7 +45,7 @@ import org.apache.commons.collections.comparators.ComparableComparator; *

* Note that this implementation is not synchronized. Use * {@link org.apache.commons.collections.BufferUtils#synchronizedBuffer(Buffer)} or - * {@link org.apache.commons.collections.buffer.SynchronizedBuffer#decorate(Buffer)} + * {@link org.apache.commons.collections.buffer.SynchronizedBuffer#synchronizedBuffer(Buffer)} * to provide synchronized access to a PriorityBuffer: *

  * Buffer heap = SynchronizedBuffer.decorate(new PriorityBuffer());
diff --git a/src/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java b/src/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
index 19befed11..edb43b1b7 100644
--- a/src/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
@@ -48,7 +48,7 @@ public class SynchronizedBuffer
      * @return a new synchronized Buffer
      * @throws IllegalArgumentException if buffer is null
      */
-    public static  Buffer decorate(Buffer buffer) {
+    public static  Buffer synchronizedBuffer(Buffer buffer) {
         return new SynchronizedBuffer(buffer);
     }
 
diff --git a/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java b/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java
index b890c16f4..dc617c770 100644
--- a/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java
+++ b/src/java/org/apache/commons/collections/buffer/TransformedBuffer.java
@@ -45,14 +45,14 @@ public class TransformedBuffer extends TransformedCollection implements Bu
      * 

* If there are any elements already in the buffer being decorated, they * are NOT transformed. - * Constrast this with {@link #decorateTransform}. + * Contrast this with {@link #transformedBuffer(Buffer, Transformer)}. * * @param buffer the buffer to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @return a new transformed Buffer * @throws IllegalArgumentException if buffer or transformer is null */ - public static Buffer decorate(Buffer buffer, Transformer transformer) { + public static Buffer transformingBuffer(Buffer buffer, Transformer transformer) { return new TransformedBuffer(buffer, transformer); } @@ -62,7 +62,7 @@ public class TransformedBuffer extends TransformedCollection implements Bu *

* If there are any elements already in the buffer being decorated, they * will be transformed by this method. - * Constrast this with {@link #decorate}. + * Contrast this with {@link #transformingBuffer(Buffer, Transformer)}. * * @param buffer the buffer to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null @@ -70,7 +70,7 @@ public class TransformedBuffer extends TransformedCollection implements Bu * @throws IllegalArgumentException if buffer or transformer is null * @since Commons Collections 3.3 */ - public static Buffer decorateTransform(Buffer buffer, Transformer transformer) { + public static Buffer transformedBuffer(Buffer buffer, Transformer transformer) { TransformedBuffer decorated = new TransformedBuffer(buffer, transformer); // throws IAE if buffer or transformer is null if (buffer.size() > 0) { @SuppressWarnings("unchecked") // buffer is type diff --git a/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java b/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java index b843a8429..3214d477c 100644 --- a/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java +++ b/src/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java @@ -55,7 +55,7 @@ public final class UnmodifiableBuffer * @return an unmodifiable Buffer * @throws IllegalArgumentException if buffer is null */ - public static Buffer decorate(Buffer buffer) { + public static Buffer unmodifiableBuffer(Buffer buffer) { if (buffer instanceof Unmodifiable) { return buffer; } @@ -101,7 +101,7 @@ public final class UnmodifiableBuffer //----------------------------------------------------------------------- @Override public Iterator iterator() { - return UnmodifiableIterator.decorate(decorated().iterator()); + return UnmodifiableIterator.unmodifiableIterator(decorated().iterator()); } @Override diff --git a/src/java/org/apache/commons/collections/collection/CompositeCollection.java b/src/java/org/apache/commons/collections/collection/CompositeCollection.java index b119f9422..963e12cba 100644 --- a/src/java/org/apache/commons/collections/collection/CompositeCollection.java +++ b/src/java/org/apache/commons/collections/collection/CompositeCollection.java @@ -163,7 +163,7 @@ public class CompositeCollection implements Collection, Serializable { */ public Iterator iterator() { if (all.isEmpty()) { - return EmptyIterator.getInstance(); + return EmptyIterator.emptyIterator(); } IteratorChain chain = new IteratorChain(); for (Collection item : all) { @@ -419,7 +419,7 @@ public class CompositeCollection implements Collection, Serializable { * @return Unmodifiable list of all collections in this composite. */ public List> getCollections() { - return UnmodifiableList.decorate(all); + return UnmodifiableList.unmodifiableList(all); } /** diff --git a/src/java/org/apache/commons/collections/collection/PredicatedCollection.java b/src/java/org/apache/commons/collections/collection/PredicatedCollection.java index 43311dfea..67a2acd02 100644 --- a/src/java/org/apache/commons/collections/collection/PredicatedCollection.java +++ b/src/java/org/apache/commons/collections/collection/PredicatedCollection.java @@ -61,7 +61,7 @@ public class PredicatedCollection extends AbstractCollectionDecorator { * @throws IllegalArgumentException if collection or predicate is null * @throws IllegalArgumentException if the collection contains invalid elements */ - public static Collection decorate(Collection coll, Predicate predicate) { + public static Collection predicatedCollection(Collection coll, Predicate predicate) { return new PredicatedCollection(coll, predicate); } diff --git a/src/java/org/apache/commons/collections/collection/SynchronizedCollection.java b/src/java/org/apache/commons/collections/collection/SynchronizedCollection.java index b31392f8a..0e7c18248 100644 --- a/src/java/org/apache/commons/collections/collection/SynchronizedCollection.java +++ b/src/java/org/apache/commons/collections/collection/SynchronizedCollection.java @@ -58,7 +58,7 @@ public class SynchronizedCollection implements Collection, Serializable { * @return a new synchronized collection * @throws IllegalArgumentException if collection is null */ - public static Collection decorate(Collection coll) { + public static Collection synchronizedCollection(Collection coll) { return new SynchronizedCollection(coll); } diff --git a/src/java/org/apache/commons/collections/collection/TransformedCollection.java b/src/java/org/apache/commons/collections/collection/TransformedCollection.java index 5f444807b..157a2693b 100644 --- a/src/java/org/apache/commons/collections/collection/TransformedCollection.java +++ b/src/java/org/apache/commons/collections/collection/TransformedCollection.java @@ -51,14 +51,14 @@ public class TransformedCollection extends AbstractCollectionDecorator { *

* If there are any elements already in the collection being decorated, they * are NOT transformed. - * Constrast this with {@link #decorateTransform}. + * Contrast this with {@link #transformedCollection(Collection, Transformer)}. * * @param coll the collection to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @return a new transformed collection * @throws IllegalArgumentException if collection or transformer is null */ - public static Collection decorate(Collection coll, Transformer transformer) { + public static Collection transformingCollection(Collection coll, Transformer transformer) { return new TransformedCollection(coll, transformer); } @@ -68,7 +68,7 @@ public class TransformedCollection extends AbstractCollectionDecorator { *

* If there are any elements already in the collection being decorated, they * will be transformed by this method. - * Constrast this with {@link #decorate}. + * Contrast this with {@link #transformingCollection(Collection, Transformer)}. * * @param collection the collection to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null @@ -76,7 +76,7 @@ public class TransformedCollection extends AbstractCollectionDecorator { * @throws IllegalArgumentException if collection or transformer is null * @since Commons Collections 3.3 */ - public static Collection decorateTransform(Collection collection, Transformer transformer) { + public static Collection transformedCollection(Collection collection, Transformer transformer) { TransformedCollection decorated = new TransformedCollection(collection, transformer); // null collection & transformer are disallowed by the constructor call above if (collection.size() > 0) { diff --git a/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java b/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java index 7b2579cb6..ed0f96a48 100644 --- a/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java +++ b/src/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollection.java @@ -54,8 +54,8 @@ public final class UnmodifiableBoundedCollection extends AbstractCollectionDe * @return a new unmodifiable bounded collection * @throws IllegalArgumentException if bag is null */ - public static BoundedCollection decorate(BoundedCollection coll) { - return new UnmodifiableBoundedCollection(coll); + public static BoundedCollection unmodifiableBoundedCollection(BoundedCollection coll) { + return unmodifiableBoundedCollection(coll); } /** @@ -69,7 +69,7 @@ public final class UnmodifiableBoundedCollection extends AbstractCollectionDe * @throws IllegalArgumentException if bag is null */ @SuppressWarnings("unchecked") - public static BoundedCollection decorateUsing(Collection coll) { + public static BoundedCollection unmodifiableBoundedCollection(Collection coll) { if (coll == null) { throw new IllegalArgumentException("The collection must not be null"); } @@ -105,7 +105,7 @@ public final class UnmodifiableBoundedCollection extends AbstractCollectionDe //----------------------------------------------------------------------- @Override public Iterator iterator() { - return UnmodifiableIterator.decorate(decorated().iterator()); + return UnmodifiableIterator.unmodifiableIterator(decorated().iterator()); } @Override diff --git a/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.java b/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.java index 29aff0adf..fb59522c7 100644 --- a/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.java +++ b/src/java/org/apache/commons/collections/collection/UnmodifiableCollection.java @@ -52,7 +52,7 @@ public final class UnmodifiableCollection * @return an unmodifiable collection * @throws IllegalArgumentException if collection is null */ - public static Collection decorate(Collection coll) { + public static Collection unmodifiableCollection(Collection coll) { if (coll instanceof Unmodifiable) { return coll; } @@ -73,7 +73,7 @@ public final class UnmodifiableCollection //----------------------------------------------------------------------- @Override public Iterator iterator() { - return UnmodifiableIterator.decorate(decorated().iterator()); + return UnmodifiableIterator.unmodifiableIterator(decorated().iterator()); } @Override diff --git a/src/java/org/apache/commons/collections/comparators/BooleanComparator.java b/src/java/org/apache/commons/collections/comparators/BooleanComparator.java index 8930c5647..082ce5748 100644 --- a/src/java/org/apache/commons/collections/comparators/BooleanComparator.java +++ b/src/java/org/apache/commons/collections/comparators/BooleanComparator.java @@ -25,7 +25,7 @@ import java.util.Comparator; *

* @see #getTrueFirstComparator() * @see #getFalseFirstComparator() - * @see #getBooleanComparator(boolean) + * @see #booleanComparator(boolean) * * @since Commons Collections 3.0 * @version $Revision$ $Date$ @@ -94,7 +94,7 @@ public final class BooleanComparator implements Comparator, Serializabl * true Booleans before false * @return a singleton BooleanComparator instance */ - public static BooleanComparator getBooleanComparator(boolean trueFirst) { + public static BooleanComparator booleanComparator(boolean trueFirst) { return trueFirst ? TRUE_FIRST : FALSE_FIRST; } diff --git a/src/java/org/apache/commons/collections/comparators/ComparableComparator.java b/src/java/org/apache/commons/collections/comparators/ComparableComparator.java index 693ba3780..411ce1354 100644 --- a/src/java/org/apache/commons/collections/comparators/ComparableComparator.java +++ b/src/java/org/apache/commons/collections/comparators/ComparableComparator.java @@ -60,7 +60,7 @@ public class ComparableComparator> implements Co * @return the singleton ComparableComparator */ @SuppressWarnings("unchecked") - public static > ComparableComparator getInstance() { + public static > ComparableComparator comparableComparator() { return (ComparableComparator) INSTANCE; } @@ -68,7 +68,7 @@ public class ComparableComparator> implements Co /** * Constructor whose use should be avoided. *

- * Please use the {@link #getInstance()} method whenever possible. + * Please use the {@link #comparableComparator()} method whenever possible. */ public ComparableComparator() { super(); diff --git a/src/java/org/apache/commons/collections/functors/AndPredicate.java b/src/java/org/apache/commons/collections/functors/AndPredicate.java index a30fcd083..596200fad 100644 --- a/src/java/org/apache/commons/collections/functors/AndPredicate.java +++ b/src/java/org/apache/commons/collections/functors/AndPredicate.java @@ -46,7 +46,7 @@ public final class AndPredicate implements Predicate, PredicateDecoratorand predicate * @throws IllegalArgumentException if either predicate is null */ - public static Predicate getInstance(Predicate predicate1, Predicate predicate2) { + public static Predicate andPredicate(Predicate predicate1, Predicate predicate2) { if (predicate1 == null || predicate2 == null) { throw new IllegalArgumentException("Predicate must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/AnyPredicate.java b/src/java/org/apache/commons/collections/functors/AnyPredicate.java index 430d6d367..86e9f1170 100644 --- a/src/java/org/apache/commons/collections/functors/AnyPredicate.java +++ b/src/java/org/apache/commons/collections/functors/AnyPredicate.java @@ -55,7 +55,7 @@ public final class AnyPredicate implements Predicate, PredicateDecorator Predicate getInstance(Predicate[] predicates) { + public static Predicate anyPredicate(Predicate... predicates) { FunctorUtils.validate(predicates); if (predicates.length == 0) { return FalsePredicate.falsePredicate(); @@ -78,7 +78,7 @@ public final class AnyPredicate implements Predicate, PredicateDecorator Predicate getInstance(Collection> predicates) { + public static Predicate anyPredicate(Collection> predicates) { Predicate[] preds = FunctorUtils.validate(predicates); if (preds.length == 0) { return FalsePredicate.falsePredicate(); diff --git a/src/java/org/apache/commons/collections/functors/ChainedClosure.java b/src/java/org/apache/commons/collections/functors/ChainedClosure.java index 4d5e9286b..830769604 100644 --- a/src/java/org/apache/commons/collections/functors/ChainedClosure.java +++ b/src/java/org/apache/commons/collections/functors/ChainedClosure.java @@ -45,10 +45,10 @@ public class ChainedClosure implements Closure, Serializable { * @throws IllegalArgumentException if the closures array is null * @throws IllegalArgumentException if any closure in the array is null */ - public static Closure getInstance(Closure[] closures) { + public static Closure chainedClosure(Closure... closures) { FunctorUtils.validate(closures); if (closures.length == 0) { - return NOPClosure.getInstance(); + return NOPClosure.nopClosure(); } closures = FunctorUtils.copy(closures); return new ChainedClosure(closures); @@ -65,12 +65,12 @@ public class ChainedClosure implements Closure, Serializable { * @throws IllegalArgumentException if any closure in the collection is null */ @SuppressWarnings("unchecked") - public static Closure getInstance(Collection> closures) { + public static Closure chainedClosure(Collection> closures) { if (closures == null) { throw new IllegalArgumentException("Closure collection must not be null"); } if (closures.size() == 0) { - return NOPClosure.getInstance(); + return NOPClosure.nopClosure(); } // convert to array like this to guarantee iterator() ordering Closure[] cmds = new Closure[closures.size()]; @@ -82,23 +82,6 @@ public class ChainedClosure implements Closure, Serializable { return new ChainedClosure(cmds); } - /** - * Factory method that performs validation. - * - * @param closure1 the first closure, not null - * @param closure2 the second closure, not null - * @return the chained closure - * @throws IllegalArgumentException if either closure is null - */ - @SuppressWarnings("unchecked") - public static Closure getInstance(Closure closure1, Closure closure2) { - if (closure1 == null || closure2 == null) { - throw new IllegalArgumentException("Closures must not be null"); - } - Closure[] closures = new Closure[] { closure1, closure2 }; - return new ChainedClosure(closures); - } - /** * Constructor that performs no validation. * Use getInstance if you want that. diff --git a/src/java/org/apache/commons/collections/functors/ChainedTransformer.java b/src/java/org/apache/commons/collections/functors/ChainedTransformer.java index 35c92965e..df4ecc8ed 100644 --- a/src/java/org/apache/commons/collections/functors/ChainedTransformer.java +++ b/src/java/org/apache/commons/collections/functors/ChainedTransformer.java @@ -48,10 +48,10 @@ public class ChainedTransformer implements Transformer, Serializable { * @throws IllegalArgumentException if the transformers array is null * @throws IllegalArgumentException if any transformer in the array is null */ - public static Transformer getInstance(Transformer[] transformers) { + public static Transformer chainedTransformer(Transformer... transformers) { FunctorUtils.validate(transformers); if (transformers.length == 0) { - return NOPTransformer.getInstance(); + return NOPTransformer.nopTransformer(); } transformers = FunctorUtils.copy(transformers); return new ChainedTransformer(transformers); @@ -68,12 +68,12 @@ public class ChainedTransformer implements Transformer, Serializable { * @throws IllegalArgumentException if any transformer in the collection is null */ @SuppressWarnings("unchecked") - public static Transformer getInstance(Collection> transformers) { + public static Transformer chainedTransformer(Collection> transformers) { if (transformers == null) { throw new IllegalArgumentException("Transformer collection must not be null"); } if (transformers.size() == 0) { - return NOPTransformer.getInstance(); + return NOPTransformer.nopTransformer(); } // convert to array like this to guarantee iterator() ordering Transformer[] cmds = transformers.toArray(new Transformer[transformers.size()]); @@ -81,23 +81,6 @@ public class ChainedTransformer implements Transformer, Serializable { return new ChainedTransformer(cmds); } - /** - * Factory method that performs validation. - * - * @param transformer1 the first transformer, not null - * @param transformer2 the second transformer, not null - * @return the chained transformer - * @throws IllegalArgumentException if either transformer is null - */ - @SuppressWarnings("unchecked") - public static Transformer getInstance(Transformer transformer1, Transformer transformer2) { - if (transformer1 == null || transformer2 == null) { - throw new IllegalArgumentException("Transformers must not be null"); - } - Transformer[] transformers = new Transformer[] { transformer1, transformer2 }; - return new ChainedTransformer(transformers); - } - /** * Constructor that performs no validation. * Use getInstance if you want that. diff --git a/src/java/org/apache/commons/collections/functors/CloneTransformer.java b/src/java/org/apache/commons/collections/functors/CloneTransformer.java index 5841b31ee..0b6e761f6 100644 --- a/src/java/org/apache/commons/collections/functors/CloneTransformer.java +++ b/src/java/org/apache/commons/collections/functors/CloneTransformer.java @@ -45,7 +45,7 @@ public class CloneTransformer implements Transformer, Serializable { * @since Commons Collections 3.1 */ @SuppressWarnings("unchecked") - public static Transformer getInstance() { + public static Transformer cloneTransformer() { return (Transformer) INSTANCE; } @@ -66,7 +66,7 @@ public class CloneTransformer implements Transformer, Serializable { if (input == null) { return null; } - return PrototypeFactory.getInstance(input).create(); + return PrototypeFactory.prototypeFactory(input).create(); } private Object readResolve() { diff --git a/src/java/org/apache/commons/collections/functors/ClosureTransformer.java b/src/java/org/apache/commons/collections/functors/ClosureTransformer.java index e54ce639f..1c7cac567 100644 --- a/src/java/org/apache/commons/collections/functors/ClosureTransformer.java +++ b/src/java/org/apache/commons/collections/functors/ClosureTransformer.java @@ -45,7 +45,7 @@ public class ClosureTransformer implements Transformer, Serializable { * @return the closure transformer * @throws IllegalArgumentException if the closure is null */ - public static Transformer getInstance(Closure closure) { + public static Transformer closureTransformer(Closure closure) { if (closure == null) { throw new IllegalArgumentException("Closure must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/ComparatorPredicate.java b/src/java/org/apache/commons/collections/functors/ComparatorPredicate.java index 3ed309c09..ece50f44d 100644 --- a/src/java/org/apache/commons/collections/functors/ComparatorPredicate.java +++ b/src/java/org/apache/commons/collections/functors/ComparatorPredicate.java @@ -105,8 +105,8 @@ public class ComparatorPredicate implements Predicate, Serializable { * @return the predicate * @throws IllegalArgumentException if comparator is null */ - public static Predicate getInstance(T object, Comparator comparator) { - return getInstance(object, comparator, Criterion.EQUAL); + public static Predicate comparatorPredicate(T object, Comparator comparator) { + return comparatorPredicate(object, comparator, Criterion.EQUAL); } /** @@ -118,7 +118,7 @@ public class ComparatorPredicate implements Predicate, Serializable { * @return the predicate * @throws IllegalArgumentException if comparator is null of criterion is invalid */ - public static Predicate getInstance(T object, Comparator comparator, Criterion criterion) { + public static Predicate comparatorPredicate(T object, Comparator comparator, Criterion criterion) { if (comparator == null) { throw new IllegalArgumentException("Comparator must not be null."); } diff --git a/src/java/org/apache/commons/collections/functors/ConstantFactory.java b/src/java/org/apache/commons/collections/functors/ConstantFactory.java index bf4a7ac68..7526042f1 100644 --- a/src/java/org/apache/commons/collections/functors/ConstantFactory.java +++ b/src/java/org/apache/commons/collections/functors/ConstantFactory.java @@ -50,7 +50,7 @@ public class ConstantFactory implements Factory, Serializable { * @return the constant factory. */ @SuppressWarnings("unchecked") - public static Factory getInstance(T constantToReturn) { + public static Factory constantFactory(T constantToReturn) { if (constantToReturn == null) { return (Factory) NULL_INSTANCE; } diff --git a/src/java/org/apache/commons/collections/functors/ConstantTransformer.java b/src/java/org/apache/commons/collections/functors/ConstantTransformer.java index d660b41ac..594923cf0 100644 --- a/src/java/org/apache/commons/collections/functors/ConstantTransformer.java +++ b/src/java/org/apache/commons/collections/functors/ConstantTransformer.java @@ -50,7 +50,7 @@ public class ConstantTransformer implements Transformer, Serializabl * @return Transformer that always returns null. */ @SuppressWarnings("unchecked") - public static Transformer getNullInstance() { + public static Transformer nullTransformer() { return (Transformer) NULL_INSTANCE; } @@ -60,9 +60,9 @@ public class ConstantTransformer implements Transformer, Serializabl * @param constantToReturn the constant object to return each time in the factory * @return the constant factory. */ - public static Transformer getInstance(O constantToReturn) { + public static Transformer constantTransformer(O constantToReturn) { if (constantToReturn == null) { - return getNullInstance(); + return nullTransformer(); } return new ConstantTransformer(constantToReturn); } diff --git a/src/java/org/apache/commons/collections/functors/DefaultEquator.java b/src/java/org/apache/commons/collections/functors/DefaultEquator.java index f90695752..4f7b4d2ab 100644 --- a/src/java/org/apache/commons/collections/functors/DefaultEquator.java +++ b/src/java/org/apache/commons/collections/functors/DefaultEquator.java @@ -60,7 +60,7 @@ public class DefaultEquator implements Equator { * @return {@link DefaultEquator#INSTANCE} */ @SuppressWarnings("unchecked") - public static DefaultEquator instance() { + public static DefaultEquator defaultEquator() { return (DefaultEquator) DefaultEquator.INSTANCE; } } diff --git a/src/java/org/apache/commons/collections/functors/EqualPredicate.java b/src/java/org/apache/commons/collections/functors/EqualPredicate.java index e609be7cc..67e36adcb 100644 --- a/src/java/org/apache/commons/collections/functors/EqualPredicate.java +++ b/src/java/org/apache/commons/collections/functors/EqualPredicate.java @@ -38,7 +38,7 @@ public final class EqualPredicate implements Predicate, Serializable { /** The value to compare to */ private final Object iValue; - + /** * Factory to create the identity predicate. * diff --git a/src/java/org/apache/commons/collections/functors/ExceptionClosure.java b/src/java/org/apache/commons/collections/functors/ExceptionClosure.java index 516111e3c..e4c3f5e71 100644 --- a/src/java/org/apache/commons/collections/functors/ExceptionClosure.java +++ b/src/java/org/apache/commons/collections/functors/ExceptionClosure.java @@ -44,7 +44,7 @@ public final class ExceptionClosure implements Closure, Serializable { * @since Commons Collections 3.1 */ @SuppressWarnings("unchecked") - public static Closure getInstance() { + public static Closure exceptionClosure() { return (Closure) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/functors/ExceptionFactory.java b/src/java/org/apache/commons/collections/functors/ExceptionFactory.java index 7c1b00d26..cdab42025 100644 --- a/src/java/org/apache/commons/collections/functors/ExceptionFactory.java +++ b/src/java/org/apache/commons/collections/functors/ExceptionFactory.java @@ -44,7 +44,7 @@ public final class ExceptionFactory implements Factory, Serializable { * @since Commons Collections 3.1 */ @SuppressWarnings("unchecked") - public static Factory getInstance() { + public static Factory exceptionFactory() { return (Factory) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/functors/ExceptionPredicate.java b/src/java/org/apache/commons/collections/functors/ExceptionPredicate.java index c8c36797f..e206fc59d 100644 --- a/src/java/org/apache/commons/collections/functors/ExceptionPredicate.java +++ b/src/java/org/apache/commons/collections/functors/ExceptionPredicate.java @@ -44,7 +44,7 @@ public final class ExceptionPredicate implements Predicate, Serializable { * @since Commons Collections 3.1 */ @SuppressWarnings("unchecked") - public static Predicate getInstance() { + public static Predicate exceptionPredicate() { return (Predicate) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/functors/ExceptionTransformer.java b/src/java/org/apache/commons/collections/functors/ExceptionTransformer.java index 308fc2a54..3c27dc9db 100644 --- a/src/java/org/apache/commons/collections/functors/ExceptionTransformer.java +++ b/src/java/org/apache/commons/collections/functors/ExceptionTransformer.java @@ -44,7 +44,7 @@ public final class ExceptionTransformer implements Transformer, Seri * @since Commons Collections 3.1 */ @SuppressWarnings("unchecked") - public static Transformer getInstance() { + public static Transformer exceptionTransformer() { return (Transformer) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/functors/FactoryTransformer.java b/src/java/org/apache/commons/collections/functors/FactoryTransformer.java index 0988d850c..d53cee4e2 100644 --- a/src/java/org/apache/commons/collections/functors/FactoryTransformer.java +++ b/src/java/org/apache/commons/collections/functors/FactoryTransformer.java @@ -44,7 +44,7 @@ public class FactoryTransformer implements Transformer, Serializable * @return the factory transformer * @throws IllegalArgumentException if the factory is null */ - public static Transformer getInstance(Factory factory) { + public static Transformer factoryTransformer(Factory factory) { if (factory == null) { throw new IllegalArgumentException("Factory must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/FalsePredicate.java b/src/java/org/apache/commons/collections/functors/FalsePredicate.java index e67008e66..07ff39b83 100644 --- a/src/java/org/apache/commons/collections/functors/FalsePredicate.java +++ b/src/java/org/apache/commons/collections/functors/FalsePredicate.java @@ -40,7 +40,7 @@ public final class FalsePredicate implements Predicate, Serializable { * Get a typed instance. * * @return the singleton instance - * @since Commons Collections 5 + * @since Commons Collections 4.0 */ @SuppressWarnings("unchecked") public static Predicate falsePredicate() { diff --git a/src/java/org/apache/commons/collections/functors/ForClosure.java b/src/java/org/apache/commons/collections/functors/ForClosure.java index f9abcbacb..9d85c3d92 100644 --- a/src/java/org/apache/commons/collections/functors/ForClosure.java +++ b/src/java/org/apache/commons/collections/functors/ForClosure.java @@ -49,9 +49,9 @@ public class ForClosure implements Closure, Serializable { * @return the for closure */ @SuppressWarnings("unchecked") - public static Closure getInstance(int count, Closure closure) { + public static Closure forClosure(int count, Closure closure) { if (count <= 0 || closure == null) { - return NOPClosure.getInstance(); + return NOPClosure.nopClosure(); } if (count == 1) { return (Closure) closure; diff --git a/src/java/org/apache/commons/collections/functors/IdentityPredicate.java b/src/java/org/apache/commons/collections/functors/IdentityPredicate.java index 5768259ab..5f33d8cae 100644 --- a/src/java/org/apache/commons/collections/functors/IdentityPredicate.java +++ b/src/java/org/apache/commons/collections/functors/IdentityPredicate.java @@ -44,7 +44,7 @@ public final class IdentityPredicate implements Predicate, Serializable { * @return the predicate * @throws IllegalArgumentException if the predicate is null */ - public static Predicate getInstance(T object) { + public static Predicate identityPredicate(T object) { if (object == null) { return NullPredicate.nullPredicate(); } diff --git a/src/java/org/apache/commons/collections/functors/IfClosure.java b/src/java/org/apache/commons/collections/functors/IfClosure.java index 733af1341..e8605aa84 100644 --- a/src/java/org/apache/commons/collections/functors/IfClosure.java +++ b/src/java/org/apache/commons/collections/functors/IfClosure.java @@ -55,8 +55,8 @@ public class IfClosure implements Closure, Serializable { * @throws IllegalArgumentException if either argument is null * @since Commons Collections 3.2 */ - public static Closure getInstance(Predicate predicate, Closure trueClosure) { - return IfClosure.getInstance(predicate, trueClosure, NOPClosure.getInstance()); + public static Closure ifClosure(Predicate predicate, Closure trueClosure) { + return IfClosure.ifClosure(predicate, trueClosure, NOPClosure.nopClosure()); } /** @@ -68,7 +68,7 @@ public class IfClosure implements Closure, Serializable { * @return the if closure * @throws IllegalArgumentException if any argument is null */ - public static Closure getInstance(Predicate predicate, Closure trueClosure, Closure falseClosure) { + public static Closure ifClosure(Predicate predicate, Closure trueClosure, Closure falseClosure) { if (predicate == null) { throw new IllegalArgumentException("Predicate must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/InstanceofPredicate.java b/src/java/org/apache/commons/collections/functors/InstanceofPredicate.java index 58fbe860e..dc376478a 100644 --- a/src/java/org/apache/commons/collections/functors/InstanceofPredicate.java +++ b/src/java/org/apache/commons/collections/functors/InstanceofPredicate.java @@ -44,7 +44,7 @@ public final class InstanceofPredicate implements Predicate, Serializabl * @return the predicate * @throws IllegalArgumentException if the class is null */ - public static Predicate getInstance(Class type) { + public static Predicate instanceOfPredicate(Class type) { if (type == null) { throw new IllegalArgumentException("The type to check instanceof must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/InstantiateFactory.java b/src/java/org/apache/commons/collections/functors/InstantiateFactory.java index 277c62c23..ac4c15abe 100644 --- a/src/java/org/apache/commons/collections/functors/InstantiateFactory.java +++ b/src/java/org/apache/commons/collections/functors/InstantiateFactory.java @@ -53,7 +53,7 @@ public class InstantiateFactory implements Factory, Serializable { * @param args the constructor arguments * @return a new instantiate factory */ - public static Factory getInstance(Class classToInstantiate, Class[] paramTypes, Object[] args) { + public static Factory instantiateFactory(Class classToInstantiate, Class[] paramTypes, Object[] args) { if (classToInstantiate == null) { throw new IllegalArgumentException("Class to instantiate must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java b/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java index 82d03914a..ce1e5f22a 100644 --- a/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java +++ b/src/java/org/apache/commons/collections/functors/InstantiateTransformer.java @@ -49,7 +49,7 @@ public class InstantiateTransformer implements Transformer * @param * @return Transformer, T> */ - public static Transformer, T> getInstance() { + public static Transformer, T> instantiateTransformer() { return new InstantiateTransformer(); } @@ -60,7 +60,7 @@ public class InstantiateTransformer implements Transformer * @param args the constructor arguments * @return an instantiate transformer */ - public static Transformer, T> getInstance(Class[] paramTypes, Object[] args) { + public static Transformer, T> instantiateTransformer(Class[] paramTypes, Object[] args) { if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { diff --git a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java index 5fa6964f8..ee2f21ef1 100644 --- a/src/java/org/apache/commons/collections/functors/InvokerTransformer.java +++ b/src/java/org/apache/commons/collections/functors/InvokerTransformer.java @@ -50,7 +50,7 @@ public class InvokerTransformer implements Transformer, Serializable * @return an invoker transformer * @since Commons Collections 3.1 */ - public static Transformer getInstance(String methodName) { + public static Transformer invokerTransformer(String methodName) { if (methodName == null) { throw new IllegalArgumentException("The method to invoke must not be null"); } @@ -65,7 +65,7 @@ public class InvokerTransformer implements Transformer, Serializable * @param args the arguments to pass to the method * @return an invoker transformer */ - public static Transformer getInstance(String methodName, Class[] paramTypes, Object[] args) { + public static Transformer invokerTransformer(String methodName, Class[] paramTypes, Object[] args) { if (methodName == null) { throw new IllegalArgumentException("The method to invoke must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/MapTransformer.java b/src/java/org/apache/commons/collections/functors/MapTransformer.java index 2bdaa9818..6ab21db8d 100644 --- a/src/java/org/apache/commons/collections/functors/MapTransformer.java +++ b/src/java/org/apache/commons/collections/functors/MapTransformer.java @@ -46,9 +46,9 @@ public final class MapTransformer implements Transformer, Serializab * @param map the map, not cloned * @return the transformer */ - public static Transformer getInstance(Map map) { + public static Transformer mapTransformer(Map map) { if (map == null) { - return ConstantTransformer.getNullInstance(); + return ConstantTransformer.nullTransformer(); } return new MapTransformer(map); } diff --git a/src/java/org/apache/commons/collections/functors/NOPClosure.java b/src/java/org/apache/commons/collections/functors/NOPClosure.java index 3b7cadbb1..fe671dc42 100644 --- a/src/java/org/apache/commons/collections/functors/NOPClosure.java +++ b/src/java/org/apache/commons/collections/functors/NOPClosure.java @@ -43,7 +43,7 @@ public final class NOPClosure implements Closure, Serializable { * @since Commons Collections 3.1 */ @SuppressWarnings("unchecked") - public static Closure getInstance() { + public static Closure nopClosure() { return (Closure) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/functors/NOPTransformer.java b/src/java/org/apache/commons/collections/functors/NOPTransformer.java index 18d4b35ad..a6b301913 100644 --- a/src/java/org/apache/commons/collections/functors/NOPTransformer.java +++ b/src/java/org/apache/commons/collections/functors/NOPTransformer.java @@ -43,7 +43,7 @@ public class NOPTransformer implements Transformer, Serializable { * @since Commons Collections 3.1 */ @SuppressWarnings("unchecked") - public static Transformer getInstance() { + public static Transformer nopTransformer() { return (Transformer) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/functors/NonePredicate.java b/src/java/org/apache/commons/collections/functors/NonePredicate.java index 11b07a19f..819708c4b 100644 --- a/src/java/org/apache/commons/collections/functors/NonePredicate.java +++ b/src/java/org/apache/commons/collections/functors/NonePredicate.java @@ -53,7 +53,7 @@ public final class NonePredicate implements Predicate, PredicateDecorator< * @throws IllegalArgumentException if the predicates array is null * @throws IllegalArgumentException if any predicate in the array is null */ - public static Predicate getInstance(Predicate[] predicates) { + public static Predicate nonePredicate(Predicate... predicates) { FunctorUtils.validate(predicates); if (predicates.length == 0) { return TruePredicate.truePredicate(); @@ -72,7 +72,7 @@ public final class NonePredicate implements Predicate, PredicateDecorator< * @throws IllegalArgumentException if the predicates array is null * @throws IllegalArgumentException if any predicate in the array is null */ - public static Predicate getInstance(Collection> predicates) { + public static Predicate nonePredicate(Collection> predicates) { Predicate[] preds = FunctorUtils.validate(predicates); if (preds.length == 0) { return TruePredicate.truePredicate(); diff --git a/src/java/org/apache/commons/collections/functors/NotNullPredicate.java b/src/java/org/apache/commons/collections/functors/NotNullPredicate.java index 19d847ce7..815b7ffcb 100644 --- a/src/java/org/apache/commons/collections/functors/NotNullPredicate.java +++ b/src/java/org/apache/commons/collections/functors/NotNullPredicate.java @@ -43,7 +43,7 @@ public final class NotNullPredicate implements Predicate, Serializable { * @since Commons Collections 3.1 */ @SuppressWarnings("unchecked") - public static Predicate getInstance() { + public static Predicate notNullPredicate() { return (Predicate) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/functors/NotPredicate.java b/src/java/org/apache/commons/collections/functors/NotPredicate.java index 4f32af35a..be86f23e7 100644 --- a/src/java/org/apache/commons/collections/functors/NotPredicate.java +++ b/src/java/org/apache/commons/collections/functors/NotPredicate.java @@ -43,7 +43,7 @@ public final class NotPredicate implements Predicate, PredicateDecorator Predicate getInstance(Predicate predicate) { + public static Predicate notPredicate(Predicate predicate) { if (predicate == null) { throw new IllegalArgumentException("Predicate must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java b/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java index e9635f37e..a1a090276 100644 --- a/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java +++ b/src/java/org/apache/commons/collections/functors/NullIsExceptionPredicate.java @@ -44,7 +44,7 @@ public final class NullIsExceptionPredicate implements Predicate, Predicat * @return the predicate * @throws IllegalArgumentException if the predicate is null */ - public static Predicate getInstance(Predicate predicate) { + public static Predicate nullIsExceptionPredicate(Predicate predicate) { if (predicate == null) { throw new IllegalArgumentException("Predicate must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/NullIsFalsePredicate.java b/src/java/org/apache/commons/collections/functors/NullIsFalsePredicate.java index 217422c17..53da2975e 100644 --- a/src/java/org/apache/commons/collections/functors/NullIsFalsePredicate.java +++ b/src/java/org/apache/commons/collections/functors/NullIsFalsePredicate.java @@ -43,7 +43,7 @@ public final class NullIsFalsePredicate implements Predicate, PredicateDec * @return the predicate * @throws IllegalArgumentException if the predicate is null */ - public static Predicate getInstance(Predicate predicate) { + public static Predicate nullIsFalsePredicate(Predicate predicate) { if (predicate == null) { throw new IllegalArgumentException("Predicate must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java b/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java index e7160a37d..dedf4b54e 100644 --- a/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java +++ b/src/java/org/apache/commons/collections/functors/NullIsTruePredicate.java @@ -43,7 +43,7 @@ public final class NullIsTruePredicate implements Predicate, PredicateDeco * @return the predicate * @throws IllegalArgumentException if the predicate is null */ - public static Predicate getInstance(Predicate predicate) { + public static Predicate nullIsTruePredicate(Predicate predicate) { if (predicate == null) { throw new IllegalArgumentException("Predicate must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/OnePredicate.java b/src/java/org/apache/commons/collections/functors/OnePredicate.java index 83fe86411..9b8c25390 100644 --- a/src/java/org/apache/commons/collections/functors/OnePredicate.java +++ b/src/java/org/apache/commons/collections/functors/OnePredicate.java @@ -55,7 +55,7 @@ public final class OnePredicate implements Predicate, PredicateDecorator Predicate getInstance(Predicate[] predicates) { + public static Predicate onePredicate(Predicate... predicates) { FunctorUtils.validate(predicates); if (predicates.length == 0) { return FalsePredicate.falsePredicate(); @@ -75,7 +75,7 @@ public final class OnePredicate implements Predicate, PredicateDecorator Predicate getInstance(Collection> predicates) { + public static Predicate onePredicate(Collection> predicates) { Predicate[] preds = FunctorUtils.validate(predicates); return new OnePredicate(preds); } diff --git a/src/java/org/apache/commons/collections/functors/OrPredicate.java b/src/java/org/apache/commons/collections/functors/OrPredicate.java index e87edbd5d..897a36b82 100644 --- a/src/java/org/apache/commons/collections/functors/OrPredicate.java +++ b/src/java/org/apache/commons/collections/functors/OrPredicate.java @@ -46,7 +46,7 @@ public final class OrPredicate implements Predicate, PredicateDecorator * @return the and predicate * @throws IllegalArgumentException if either predicate is null */ - public static Predicate getInstance(Predicate predicate1, Predicate predicate2) { + public static Predicate orPredicate(Predicate predicate1, Predicate predicate2) { if (predicate1 == null || predicate2 == null) { throw new IllegalArgumentException("Predicate must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/PredicateTransformer.java b/src/java/org/apache/commons/collections/functors/PredicateTransformer.java index 72dceb0c3..98dc4f7e1 100644 --- a/src/java/org/apache/commons/collections/functors/PredicateTransformer.java +++ b/src/java/org/apache/commons/collections/functors/PredicateTransformer.java @@ -45,7 +45,7 @@ public class PredicateTransformer implements Transformer, Seriali * @return the predicate transformer * @throws IllegalArgumentException if the predicate is null */ - public static Transformer getInstance(Predicate predicate) { + public static Transformer predicateTransformer(Predicate predicate) { if (predicate == null) { throw new IllegalArgumentException("Predicate must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/PrototypeFactory.java b/src/java/org/apache/commons/collections/functors/PrototypeFactory.java index 5c6d94b58..ed1852a4c 100644 --- a/src/java/org/apache/commons/collections/functors/PrototypeFactory.java +++ b/src/java/org/apache/commons/collections/functors/PrototypeFactory.java @@ -56,9 +56,9 @@ public class PrototypeFactory { * @throws IllegalArgumentException if the prototype cannot be cloned */ @SuppressWarnings("unchecked") - public static Factory getInstance(T prototype) { + public static Factory prototypeFactory(T prototype) { if (prototype == null) { - return ConstantFactory.getInstance(null); + return ConstantFactory.constantFactory(null); } try { Method method = prototype.getClass().getMethod("clone", (Class[]) null); diff --git a/src/java/org/apache/commons/collections/functors/StringValueTransformer.java b/src/java/org/apache/commons/collections/functors/StringValueTransformer.java index e95cfc038..00ae48b78 100644 --- a/src/java/org/apache/commons/collections/functors/StringValueTransformer.java +++ b/src/java/org/apache/commons/collections/functors/StringValueTransformer.java @@ -44,7 +44,7 @@ public final class StringValueTransformer implements Transformer, * @since Commons Collections 3.1 */ @SuppressWarnings("unchecked") - public static Transformer getInstance() { + public static Transformer stringValueTransformer() { return (Transformer) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/functors/SwitchClosure.java b/src/java/org/apache/commons/collections/functors/SwitchClosure.java index 1ee7806d4..dc05d7a10 100644 --- a/src/java/org/apache/commons/collections/functors/SwitchClosure.java +++ b/src/java/org/apache/commons/collections/functors/SwitchClosure.java @@ -54,14 +54,14 @@ public class SwitchClosure implements Closure, Serializable { * @throws IllegalArgumentException if any element in the array is null */ @SuppressWarnings("unchecked") - public static Closure getInstance(Predicate[] predicates, Closure[] closures, Closure defaultClosure) { + public static Closure switchClosure(Predicate[] predicates, Closure[] closures, Closure defaultClosure) { FunctorUtils.validate(predicates); FunctorUtils.validate(closures); if (predicates.length != closures.length) { throw new IllegalArgumentException("The predicate and closure arrays must be the same size"); } if (predicates.length == 0) { - return (Closure) (defaultClosure == null ? NOPClosure.getInstance(): defaultClosure); + return (Closure) (defaultClosure == null ? NOPClosure.nopClosure(): defaultClosure); } predicates = FunctorUtils.copy(predicates); closures = FunctorUtils.copy(closures); @@ -86,7 +86,7 @@ public class SwitchClosure implements Closure, Serializable { * @throws ClassCastException if the map elements are of the wrong type */ @SuppressWarnings("unchecked") - public static Closure getInstance(Map, Closure> predicatesAndClosures) { + public static Closure switchClosure(Map, Closure> predicatesAndClosures) { if (predicatesAndClosures == null) { throw new IllegalArgumentException("The predicate and closure map must not be null"); } @@ -94,7 +94,7 @@ public class SwitchClosure implements Closure, Serializable { Closure defaultClosure = predicatesAndClosures.remove(null); int size = predicatesAndClosures.size(); if (size == 0) { - return (Closure) (defaultClosure == null ? NOPClosure.getInstance() : defaultClosure); + return (Closure) (defaultClosure == null ? NOPClosure.nopClosure() : defaultClosure); } Closure[] closures = new Closure[size]; Predicate[] preds = new Predicate[size]; @@ -120,7 +120,7 @@ public class SwitchClosure implements Closure, Serializable { super(); iPredicates = predicates; iClosures = closures; - iDefault = (Closure) (defaultClosure == null ? NOPClosure.getInstance() : defaultClosure); + iDefault = (Closure) (defaultClosure == null ? NOPClosure.nopClosure() : defaultClosure); } /** diff --git a/src/java/org/apache/commons/collections/functors/SwitchTransformer.java b/src/java/org/apache/commons/collections/functors/SwitchTransformer.java index 0fc71cc62..feb5101be 100644 --- a/src/java/org/apache/commons/collections/functors/SwitchTransformer.java +++ b/src/java/org/apache/commons/collections/functors/SwitchTransformer.java @@ -54,7 +54,7 @@ public class SwitchTransformer implements Transformer, Serializable * @throws IllegalArgumentException if any element in the array is null */ @SuppressWarnings("unchecked") - public static Transformer getInstance(Predicate[] predicates, + public static Transformer switchTransformer(Predicate[] predicates, Transformer[] transformers, Transformer defaultTransformer) { FunctorUtils.validate(predicates); @@ -63,7 +63,7 @@ public class SwitchTransformer implements Transformer, Serializable throw new IllegalArgumentException("The predicate and transformer arrays must be the same size"); } if (predicates.length == 0) { - return (Transformer) (defaultTransformer == null ? ConstantTransformer.getNullInstance() : defaultTransformer); + return (Transformer) (defaultTransformer == null ? ConstantTransformer.nullTransformer() : defaultTransformer); } predicates = FunctorUtils.copy(predicates); transformers = FunctorUtils.copy(transformers); @@ -88,19 +88,19 @@ public class SwitchTransformer implements Transformer, Serializable * @throws ClassCastException if the map elements are of the wrong type */ @SuppressWarnings("unchecked") - public static Transformer getInstance( + public static Transformer switchTransformer( Map, ? extends Transformer> predicatesAndTransformers) { if (predicatesAndTransformers == null) { throw new IllegalArgumentException("The predicate and transformer map must not be null"); } if (predicatesAndTransformers.size() == 0) { - return ConstantTransformer.getNullInstance(); + return ConstantTransformer.nullTransformer(); } // convert to array like this to guarantee iterator() ordering Transformer defaultTransformer = predicatesAndTransformers.remove(null); int size = predicatesAndTransformers.size(); if (size == 0) { - return (Transformer) (defaultTransformer == null ? ConstantTransformer.getNullInstance() : defaultTransformer); + return (Transformer) (defaultTransformer == null ? ConstantTransformer.nullTransformer() : defaultTransformer); } Transformer[] transformers = new Transformer[size]; Predicate[] preds = new Predicate[size]; @@ -128,7 +128,7 @@ public class SwitchTransformer implements Transformer, Serializable super(); iPredicates = predicates; iTransformers = transformers; - iDefault = (Transformer) (defaultTransformer == null ? ConstantTransformer.getNullInstance() : defaultTransformer); + iDefault = (Transformer) (defaultTransformer == null ? ConstantTransformer.nullTransformer() : defaultTransformer); } /** diff --git a/src/java/org/apache/commons/collections/functors/TransformedPredicate.java b/src/java/org/apache/commons/collections/functors/TransformedPredicate.java index 5b5d3ed24..c15cc70f7 100644 --- a/src/java/org/apache/commons/collections/functors/TransformedPredicate.java +++ b/src/java/org/apache/commons/collections/functors/TransformedPredicate.java @@ -49,7 +49,7 @@ public final class TransformedPredicate implements Predicate, PredicateDec * @return the predicate * @throws IllegalArgumentException if the transformer or the predicate is null */ - public static Predicate getInstance(Transformer transformer, Predicate predicate) { + public static Predicate transformedPredicate(Transformer transformer, Predicate predicate) { if (transformer == null) { throw new IllegalArgumentException("The transformer to call must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/TransformerClosure.java b/src/java/org/apache/commons/collections/functors/TransformerClosure.java index 79c41bbde..57cf59d2e 100644 --- a/src/java/org/apache/commons/collections/functors/TransformerClosure.java +++ b/src/java/org/apache/commons/collections/functors/TransformerClosure.java @@ -46,9 +46,9 @@ public class TransformerClosure implements Closure, Serializable { * @param transformer the transformer to call, null means nop * @return the transformer closure */ - public static Closure getInstance(Transformer transformer) { + public static Closure transformerClosure(Transformer transformer) { if (transformer == null) { - return NOPClosure.getInstance(); + return NOPClosure.nopClosure(); } return new TransformerClosure(transformer); } diff --git a/src/java/org/apache/commons/collections/functors/TransformerPredicate.java b/src/java/org/apache/commons/collections/functors/TransformerPredicate.java index c912ac23f..0db6ffaa2 100644 --- a/src/java/org/apache/commons/collections/functors/TransformerPredicate.java +++ b/src/java/org/apache/commons/collections/functors/TransformerPredicate.java @@ -45,7 +45,7 @@ public final class TransformerPredicate implements Predicate, Serializable * @return the predicate * @throws IllegalArgumentException if the transformer is null */ - public static Predicate getInstance(Transformer transformer) { + public static Predicate transformerPredicate(Transformer transformer) { if (transformer == null) { throw new IllegalArgumentException("The transformer to call must not be null"); } diff --git a/src/java/org/apache/commons/collections/functors/UniquePredicate.java b/src/java/org/apache/commons/collections/functors/UniquePredicate.java index 22f189f3e..ecaa1fff6 100644 --- a/src/java/org/apache/commons/collections/functors/UniquePredicate.java +++ b/src/java/org/apache/commons/collections/functors/UniquePredicate.java @@ -45,7 +45,7 @@ public final class UniquePredicate implements Predicate, Serializable { * @return the predicate * @throws IllegalArgumentException if the predicate is null */ - public static Predicate getInstance() { + public static Predicate uniquePredicate() { return new UniquePredicate(); } diff --git a/src/java/org/apache/commons/collections/functors/WhileClosure.java b/src/java/org/apache/commons/collections/functors/WhileClosure.java index a1bf7cb9d..3b78840d9 100644 --- a/src/java/org/apache/commons/collections/functors/WhileClosure.java +++ b/src/java/org/apache/commons/collections/functors/WhileClosure.java @@ -51,7 +51,7 @@ public class WhileClosure implements Closure, Serializable { * @return the while closure * @throws IllegalArgumentException if the predicate or closure is null */ - public static Closure getInstance(Predicate predicate, Closure closure, boolean doLoop) { + public static Closure whileClosure(Predicate predicate, Closure closure, boolean doLoop) { if (predicate == null) { throw new IllegalArgumentException("Predicate must not be null"); } diff --git a/src/java/org/apache/commons/collections/iterators/CollatingIterator.java b/src/java/org/apache/commons/collections/iterators/CollatingIterator.java index f2e00e578..f8f936dd2 100644 --- a/src/java/org/apache/commons/collections/iterators/CollatingIterator.java +++ b/src/java/org/apache/commons/collections/iterators/CollatingIterator.java @@ -201,7 +201,7 @@ public class CollatingIterator implements Iterator { * @return the unmodifiable list of iterators added */ public List> getIterators() { - return UnmodifiableList.decorate(iterators); + return UnmodifiableList.unmodifiableList(iterators); } /** diff --git a/src/java/org/apache/commons/collections/iterators/EmptyIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyIterator.java index c8657f381..d41351533 100644 --- a/src/java/org/apache/commons/collections/iterators/EmptyIterator.java +++ b/src/java/org/apache/commons/collections/iterators/EmptyIterator.java @@ -52,7 +52,7 @@ public class EmptyIterator extends AbstractEmptyIterator implements Resett * @return ResettableIterator */ @SuppressWarnings("unchecked") - public static ResettableIterator getResettableInstance() { + public static ResettableIterator resettableEmptyIterator() { return (ResettableIterator) RESETTABLE_INSTANCE; } @@ -62,7 +62,7 @@ public class EmptyIterator extends AbstractEmptyIterator implements Resett * @return Iterator */ @SuppressWarnings("unchecked") - public static Iterator getInstance() { + public static Iterator emptyIterator() { return (Iterator) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java index 8fee2e138..8840f86a4 100644 --- a/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java +++ b/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java @@ -53,7 +53,7 @@ public class EmptyListIterator extends AbstractEmptyIterator implements * @return {@link ResettableListIterator} */ @SuppressWarnings("unchecked") - public static ResettableListIterator getResettableInstance() { + public static ResettableListIterator resettableEmptyListIterator() { return (ResettableListIterator) RESETTABLE_INSTANCE; } @@ -63,7 +63,7 @@ public class EmptyListIterator extends AbstractEmptyIterator implements * @return {@link ListIterator} */ @SuppressWarnings("unchecked") - public static ListIterator getInstance() { + public static ListIterator emptyListIterator() { return (ListIterator) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java index 507d5dc3b..2f7ae964e 100644 --- a/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java +++ b/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java @@ -43,7 +43,7 @@ public class EmptyMapIterator extends AbstractEmptyMapIterator imple * @return {@link MapIterator} */ @SuppressWarnings("unchecked") - public static MapIterator getInstance() { + public static MapIterator emptyMapIterator() { return (MapIterator) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java index 35406f811..17f6cbef5 100644 --- a/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java +++ b/src/java/org/apache/commons/collections/iterators/EmptyOrderedIterator.java @@ -41,7 +41,7 @@ public class EmptyOrderedIterator extends AbstractEmptyIterator implements * @return OrderedIterator */ @SuppressWarnings("unchecked") - public static OrderedIterator getInstance() { + public static OrderedIterator emptyOrderedIterator() { return (OrderedIterator) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java index 0f029dc5e..2bb82afe4 100644 --- a/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java +++ b/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java @@ -43,7 +43,7 @@ public class EmptyOrderedMapIterator extends AbstractEmptyMapIterator */ @SuppressWarnings("unchecked") - public static OrderedMapIterator getInstance() { + public static OrderedMapIterator emptyOrderedMapIterator() { return (OrderedMapIterator) INSTANCE; } diff --git a/src/java/org/apache/commons/collections/iterators/IteratorChain.java b/src/java/org/apache/commons/collections/iterators/IteratorChain.java index 8d33c101c..91aca1ec6 100644 --- a/src/java/org/apache/commons/collections/iterators/IteratorChain.java +++ b/src/java/org/apache/commons/collections/iterators/IteratorChain.java @@ -127,7 +127,7 @@ public class IteratorChain implements Iterator { * @param iteratorChain the array of iterators, not null * @throws NullPointerException if iterators array is or contains null */ - public IteratorChain(Iterator[] iteratorChain) { + public IteratorChain(Iterator... iteratorChain) { super(); for (int i = 0; i < iteratorChain.length; i++) { addIterator(iteratorChain[i]); @@ -193,7 +193,7 @@ public class IteratorChain implements Iterator { * @return the unmodifiable list of iterators added */ public List> getIterators() { - return UnmodifiableList.decorate(iteratorChain); + return UnmodifiableList.unmodifiableList(iteratorChain); } /** @@ -243,7 +243,7 @@ public class IteratorChain implements Iterator { protected void updateCurrentIterator() { if (currentIterator == null) { if (iteratorChain.isEmpty()) { - currentIterator = EmptyIterator. getInstance(); + currentIterator = EmptyIterator. emptyIterator(); } else { currentIterator = iteratorChain.get(0); } diff --git a/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java index 344311c4e..3d175aae4 100644 --- a/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ObjectArrayIterator.java @@ -69,7 +69,7 @@ public class ObjectArrayIterator * @param array the array to iterate over * @throws NullPointerException if array is null */ - public ObjectArrayIterator(E[] array) { + public ObjectArrayIterator(E... array) { this(array, 0, array.length); } diff --git a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java index bb3397f95..db852128c 100644 --- a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java @@ -69,7 +69,7 @@ public class ObjectArrayListIterator extends ObjectArrayIterator * @param array the array to iterate over * @throws NullPointerException if array is null */ - public ObjectArrayListIterator(E[] array) { + public ObjectArrayListIterator(E... array) { super(array); } diff --git a/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.java b/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.java index 64a4b54f8..0b90f7b3e 100644 --- a/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.java +++ b/src/java/org/apache/commons/collections/iterators/UniqueFilterIterator.java @@ -40,7 +40,7 @@ public class UniqueFilterIterator extends FilterIterator { * @param iterator the iterator to use */ public UniqueFilterIterator(Iterator iterator) { - super(iterator, UniquePredicate.getInstance()); + super(iterator, UniquePredicate.uniquePredicate()); } } diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java index 6048bfacc..9a8aa698a 100644 --- a/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java +++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableIterator.java @@ -44,7 +44,7 @@ public final class UnmodifiableIterator implements Iterator, Unmodifiable * @param iterator the iterator to decorate * @throws IllegalArgumentException if the iterator is null */ - public static Iterator decorate(Iterator iterator) { + public static Iterator unmodifiableIterator(Iterator iterator) { if (iterator == null) { throw new IllegalArgumentException("Iterator must not be null"); } diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java index 5c4d623d4..bab5eabb9 100644 --- a/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java +++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableListIterator.java @@ -42,7 +42,7 @@ public final class UnmodifiableListIterator implements ListIterator, Unmod * @param iterator the iterator to decorate * @throws IllegalArgumentException if the iterator is null */ - public static ListIterator decorate(ListIterator iterator) { + public static ListIterator umodifiableListIterator(ListIterator iterator) { if (iterator == null) { throw new IllegalArgumentException("ListIterator must not be null"); } diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java index 017fe2640..1519e23de 100644 --- a/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java +++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableMapIterator.java @@ -41,7 +41,7 @@ public final class UnmodifiableMapIterator implements MapIterator, U * @param iterator the iterator to decorate * @throws IllegalArgumentException if the iterator is null */ - public static MapIterator decorate(MapIterator iterator) { + public static MapIterator unmodifiableMapIterator(MapIterator iterator) { if (iterator == null) { throw new IllegalArgumentException("MapIterator must not be null"); } diff --git a/src/java/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java b/src/java/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java index be8d72955..d1f44aeac 100644 --- a/src/java/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java +++ b/src/java/org/apache/commons/collections/iterators/UnmodifiableOrderedMapIterator.java @@ -42,7 +42,7 @@ public final class UnmodifiableOrderedMapIterator implements OrderedMapIte * @param iterator the iterator to decorate * @throws IllegalArgumentException if the iterator is null */ - public static OrderedMapIterator decorate(OrderedMapIterator iterator) { + public static OrderedMapIterator unmodifiableOrderedMapIterator(OrderedMapIterator iterator) { if (iterator == null) { throw new IllegalArgumentException("OrderedMapIterator must not be null"); } diff --git a/src/java/org/apache/commons/collections/list/FixedSizeList.java b/src/java/org/apache/commons/collections/list/FixedSizeList.java index c875d615f..733d84dfb 100644 --- a/src/java/org/apache/commons/collections/list/FixedSizeList.java +++ b/src/java/org/apache/commons/collections/list/FixedSizeList.java @@ -52,7 +52,7 @@ public class FixedSizeList * @param list the list to decorate, must not be null * @throws IllegalArgumentException if list is null */ - public static List decorate(List list) { + public static List fixedSizeList(List list) { return new FixedSizeList(list); } @@ -105,7 +105,7 @@ public class FixedSizeList @Override public Iterator iterator() { - return UnmodifiableIterator.decorate(decorated().iterator()); + return UnmodifiableIterator.unmodifiableIterator(decorated().iterator()); } @Override diff --git a/src/java/org/apache/commons/collections/list/GrowthList.java b/src/java/org/apache/commons/collections/list/GrowthList.java index f31b750a7..17a863d5c 100644 --- a/src/java/org/apache/commons/collections/list/GrowthList.java +++ b/src/java/org/apache/commons/collections/list/GrowthList.java @@ -66,7 +66,7 @@ public class GrowthList extends AbstractSerializableListDecorator { * @param list the list to decorate, must not be null * @throws IllegalArgumentException if list is null */ - public static List decorate(List list) { + public static List growthList(List list) { return new GrowthList(list); } diff --git a/src/java/org/apache/commons/collections/list/LazyList.java b/src/java/org/apache/commons/collections/list/LazyList.java index 167e858d2..4e156c479 100644 --- a/src/java/org/apache/commons/collections/list/LazyList.java +++ b/src/java/org/apache/commons/collections/list/LazyList.java @@ -76,7 +76,7 @@ public class LazyList extends AbstractSerializableListDecorator { * @param factory the factory to use for creation, must not be null * @throws IllegalArgumentException if list or factory is null */ - public static List decorate(List list, Factory factory) { + public static List lazyList(List list, Factory factory) { return new LazyList(list, factory); } diff --git a/src/java/org/apache/commons/collections/list/PredicatedList.java b/src/java/org/apache/commons/collections/list/PredicatedList.java index 61195371c..8f7b3181e 100644 --- a/src/java/org/apache/commons/collections/list/PredicatedList.java +++ b/src/java/org/apache/commons/collections/list/PredicatedList.java @@ -60,7 +60,7 @@ public class PredicatedList extends PredicatedCollection implements List List decorate(List list, Predicate predicate) { + public static List predicatedList(List list, Predicate predicate) { return new PredicatedList(list, predicate); } diff --git a/src/java/org/apache/commons/collections/list/SetUniqueList.java b/src/java/org/apache/commons/collections/list/SetUniqueList.java index 2cac90413..14900c0d4 100644 --- a/src/java/org/apache/commons/collections/list/SetUniqueList.java +++ b/src/java/org/apache/commons/collections/list/SetUniqueList.java @@ -70,7 +70,7 @@ public class SetUniqueList extends AbstractSerializableListDecorator { * @param list the list to decorate, must not be null * @throws IllegalArgumentException if list is null */ - public static SetUniqueList decorate(List list) { + public static SetUniqueList setUniqueList(List list) { if (list == null) { throw new IllegalArgumentException("List must not be null"); } @@ -109,7 +109,7 @@ public class SetUniqueList extends AbstractSerializableListDecorator { * @return an unmodifiable set view */ public Set asSet() { - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } //----------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/list/SynchronizedList.java b/src/java/org/apache/commons/collections/list/SynchronizedList.java index 3a234e058..b171beb7c 100644 --- a/src/java/org/apache/commons/collections/list/SynchronizedList.java +++ b/src/java/org/apache/commons/collections/list/SynchronizedList.java @@ -46,7 +46,7 @@ public class SynchronizedList extends SynchronizedCollection implements Li * @param list the list to decorate, must not be null * @throws IllegalArgumentException if list is null */ - public static List decorate(List list) { + public static List synchronizedList(List list) { return new SynchronizedList(list); } diff --git a/src/java/org/apache/commons/collections/list/TransformedList.java b/src/java/org/apache/commons/collections/list/TransformedList.java index 7ffb14aef..473c20585 100644 --- a/src/java/org/apache/commons/collections/list/TransformedList.java +++ b/src/java/org/apache/commons/collections/list/TransformedList.java @@ -49,13 +49,13 @@ public class TransformedList extends TransformedCollection implements List *

* If there are any elements already in the list being decorated, they * are NOT transformed. - * Constrast this with {@link #decorateTransform}. + * Contrast this with {@link #transformedList(List, Transformer)}. * * @param list the list to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @throws IllegalArgumentException if list or transformer is null */ - public static List decorate(List list, Transformer transformer) { + public static List transformingList(List list, Transformer transformer) { return new TransformedList(list, transformer); } @@ -65,7 +65,7 @@ public class TransformedList extends TransformedCollection implements List *

* If there are any elements already in the list being decorated, they * will be transformed by this method. - * Constrast this with {@link #decorate}. + * Contrast this with {@link #transformingList(List, Transformer)}. * * @param list the list to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null @@ -73,7 +73,7 @@ public class TransformedList extends TransformedCollection implements List * @throws IllegalArgumentException if list or transformer is null * @since Commons Collections 3.3 */ - public static List decorateTransform(List list, Transformer transformer) { + public static List transformedList(List list, Transformer transformer) { TransformedList decorated = new TransformedList(list, transformer); if (transformer != null && list != null && list.size() > 0) { @SuppressWarnings("unchecked") // list is of type E diff --git a/src/java/org/apache/commons/collections/list/UnmodifiableList.java b/src/java/org/apache/commons/collections/list/UnmodifiableList.java index 207141d77..b9a3c2385 100644 --- a/src/java/org/apache/commons/collections/list/UnmodifiableList.java +++ b/src/java/org/apache/commons/collections/list/UnmodifiableList.java @@ -50,7 +50,7 @@ public final class UnmodifiableList * @param list the list to decorate, must not be null * @throws IllegalArgumentException if list is null */ - public static List decorate(List list) { + public static List unmodifiableList(List list) { if (list instanceof Unmodifiable) { return list; } @@ -72,7 +72,7 @@ public final class UnmodifiableList //----------------------------------------------------------------------- @Override public Iterator iterator() { - return UnmodifiableIterator.decorate(decorated().iterator()); + return UnmodifiableIterator.unmodifiableIterator(decorated().iterator()); } @Override @@ -108,12 +108,12 @@ public final class UnmodifiableList //----------------------------------------------------------------------- @Override public ListIterator listIterator() { - return UnmodifiableListIterator.decorate(decorated().listIterator()); + return UnmodifiableListIterator.umodifiableListIterator(decorated().listIterator()); } @Override public ListIterator listIterator(int index) { - return UnmodifiableListIterator.decorate(decorated().listIterator(index)); + return UnmodifiableListIterator.umodifiableListIterator(decorated().listIterator(index)); } @Override diff --git a/src/java/org/apache/commons/collections/map/AbstractHashedMap.java b/src/java/org/apache/commons/collections/map/AbstractHashedMap.java index 0f10a79dc..d9a52a643 100644 --- a/src/java/org/apache/commons/collections/map/AbstractHashedMap.java +++ b/src/java/org/apache/commons/collections/map/AbstractHashedMap.java @@ -757,7 +757,7 @@ public class AbstractHashedMap extends AbstractMap implements Iterab */ public MapIterator mapIterator() { if (size == 0) { - return EmptyMapIterator.getInstance(); + return EmptyMapIterator.emptyMapIterator(); } return new HashMapIterator(this); } @@ -824,7 +824,7 @@ public class AbstractHashedMap extends AbstractMap implements Iterab */ protected Iterator> createEntrySetIterator() { if (size() == 0) { - return EmptyIterator.>getInstance(); + return EmptyIterator.>emptyIterator(); } return new EntrySetIterator(this); } @@ -918,7 +918,7 @@ public class AbstractHashedMap extends AbstractMap implements Iterab */ protected Iterator createKeySetIterator() { if (size() == 0) { - return EmptyIterator.getInstance(); + return EmptyIterator.emptyIterator(); } return new KeySetIterator(this); } @@ -1002,7 +1002,7 @@ public class AbstractHashedMap extends AbstractMap implements Iterab */ protected Iterator createValuesIterator() { if (size() == 0) { - return EmptyIterator.getInstance(); + return EmptyIterator.emptyIterator(); } return new ValuesIterator(this); } diff --git a/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java b/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java index b928e06ea..a04bcc977 100644 --- a/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java +++ b/src/java/org/apache/commons/collections/map/AbstractLinkedMap.java @@ -341,7 +341,7 @@ public abstract class AbstractLinkedMap extends AbstractHashedMap im @Override public OrderedMapIterator mapIterator() { if (size == 0) { - return EmptyOrderedMapIterator.getInstance(); + return EmptyOrderedMapIterator.emptyOrderedMapIterator(); } return new LinkMapIterator(this); } @@ -399,7 +399,7 @@ public abstract class AbstractLinkedMap extends AbstractHashedMap im @Override protected Iterator> createEntrySetIterator() { if (size() == 0) { - return EmptyOrderedIterator.>getInstance(); + return EmptyOrderedIterator.>emptyOrderedIterator(); } return new EntrySetIterator(this); } @@ -433,7 +433,7 @@ public abstract class AbstractLinkedMap extends AbstractHashedMap im @Override protected Iterator createKeySetIterator() { if (size() == 0) { - return EmptyOrderedIterator.getInstance(); + return EmptyOrderedIterator.emptyOrderedIterator(); } return new KeySetIterator(this); } @@ -468,7 +468,7 @@ public abstract class AbstractLinkedMap extends AbstractHashedMap im @Override protected Iterator createValuesIterator() { if (size() == 0) { - return EmptyOrderedIterator.getInstance(); + return EmptyOrderedIterator.emptyOrderedIterator(); } return new ValuesIterator(this); } diff --git a/src/java/org/apache/commons/collections/map/CompositeMap.java b/src/java/org/apache/commons/collections/map/CompositeMap.java index 8dd13d0cc..c9f8c683f 100644 --- a/src/java/org/apache/commons/collections/map/CompositeMap.java +++ b/src/java/org/apache/commons/collections/map/CompositeMap.java @@ -94,7 +94,7 @@ public class CompositeMap extends AbstractIterableMap implements Ser * @param composite the Maps to be composited * @throws IllegalArgumentException if there is a key collision */ - public CompositeMap(Map[] composite) { + public CompositeMap(Map... composite) { this(composite, null); } diff --git a/src/java/org/apache/commons/collections/map/DefaultedMap.java b/src/java/org/apache/commons/collections/map/DefaultedMap.java index 94ff80f3a..ef138d1e5 100644 --- a/src/java/org/apache/commons/collections/map/DefaultedMap.java +++ b/src/java/org/apache/commons/collections/map/DefaultedMap.java @@ -82,8 +82,8 @@ public class DefaultedMap extends AbstractMapDecorator implements Se * @param defaultValue the default value to return when the key is not found * @throws IllegalArgumentException if map is null */ - public static Map decorate(Map map, V defaultValue) { - return new DefaultedMap(map, ConstantTransformer.getInstance(defaultValue)); + public static Map defaultedMap(Map map, V defaultValue) { + return new DefaultedMap(map, ConstantTransformer.constantTransformer(defaultValue)); } /** @@ -96,11 +96,11 @@ public class DefaultedMap extends AbstractMapDecorator implements Se * @param factory the factory to use to create entries, must not be null * @throws IllegalArgumentException if map or factory is null */ - public static IterableMap decorate(Map map, Factory factory) { + public static IterableMap defaultedMap(Map map, Factory factory) { if (factory == null) { throw new IllegalArgumentException("Factory must not be null"); } - return new DefaultedMap(map, FactoryTransformer.getInstance(factory)); + return new DefaultedMap(map, FactoryTransformer.factoryTransformer(factory)); } /** @@ -114,7 +114,7 @@ public class DefaultedMap extends AbstractMapDecorator implements Se * @param transformer the transformer to use as a factory to create entries, must not be null * @throws IllegalArgumentException if map or factory is null */ - public static Map decorate(Map map, Transformer transformer) { + public static Map defaultedMap(Map map, Transformer transformer) { if (transformer == null) { throw new IllegalArgumentException("Transformer must not be null"); } @@ -132,7 +132,7 @@ public class DefaultedMap extends AbstractMapDecorator implements Se * @param defaultValue the default value to return when the key is not found */ public DefaultedMap(V defaultValue) { - this(ConstantTransformer.getInstance(defaultValue)); + this(ConstantTransformer.constantTransformer(defaultValue)); } /** diff --git a/src/java/org/apache/commons/collections/map/FixedSizeMap.java b/src/java/org/apache/commons/collections/map/FixedSizeMap.java index 114c20e34..a799095aa 100644 --- a/src/java/org/apache/commons/collections/map/FixedSizeMap.java +++ b/src/java/org/apache/commons/collections/map/FixedSizeMap.java @@ -69,7 +69,7 @@ public class FixedSizeMap * @param map the map to decorate, must not be null * @throws IllegalArgumentException if map is null */ - public static IterableMap decorate(Map map) { + public static IterableMap fixedSizeMap(Map map) { return new FixedSizeMap(map); } @@ -144,19 +144,19 @@ public class FixedSizeMap public Set> entrySet() { Set> set = map.entrySet(); // unmodifiable set will still allow modification via Map.Entry objects - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } @Override public Set keySet() { Set set = map.keySet(); - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } @Override public Collection values() { Collection coll = map.values(); - return UnmodifiableCollection.decorate(coll); + return UnmodifiableCollection.unmodifiableCollection(coll); } public boolean isFull() { diff --git a/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java b/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java index 48f19e1b5..4cdc79527 100644 --- a/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java +++ b/src/java/org/apache/commons/collections/map/FixedSizeSortedMap.java @@ -70,7 +70,7 @@ public class FixedSizeSortedMap * @param map the map to decorate, must not be null * @throws IllegalArgumentException if map is null */ - public static SortedMap decorate(SortedMap map) { + public static SortedMap fixedSizeSortedMap(SortedMap map) { return new FixedSizeSortedMap(map); } @@ -141,17 +141,17 @@ public class FixedSizeSortedMap @Override public Set> entrySet() { - return UnmodifiableSet.decorate(map.entrySet()); + return UnmodifiableSet.unmodifiableSet(map.entrySet()); } @Override public Set keySet() { - return UnmodifiableSet.decorate(map.keySet()); + return UnmodifiableSet.unmodifiableSet(map.keySet()); } @Override public Collection values() { - return UnmodifiableCollection.decorate(map.values()); + return UnmodifiableCollection.unmodifiableCollection(map.values()); } //----------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/map/Flat3Map.java b/src/java/org/apache/commons/collections/map/Flat3Map.java index cb4f92ad5..54c23d672 100644 --- a/src/java/org/apache/commons/collections/map/Flat3Map.java +++ b/src/java/org/apache/commons/collections/map/Flat3Map.java @@ -573,7 +573,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneabl return delegateMap.mapIterator(); } if (size == 0) { - return EmptyMapIterator.getInstance(); + return EmptyMapIterator.emptyMapIterator(); } return new FlatMapIterator(this); } @@ -731,7 +731,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneabl return parent.delegateMap.entrySet().iterator(); } if (parent.size() == 0) { - return EmptyIterator.>getInstance(); + return EmptyIterator.>emptyIterator(); } return new EntrySetIterator(parent); } @@ -922,7 +922,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneabl return parent.delegateMap.keySet().iterator(); } if (parent.size() == 0) { - return EmptyIterator.getInstance(); + return EmptyIterator.emptyIterator(); } return new KeySetIterator(parent); } @@ -990,7 +990,7 @@ public class Flat3Map implements IterableMap, Serializable, Cloneabl return parent.delegateMap.values().iterator(); } if (parent.size() == 0) { - return EmptyIterator.getInstance(); + return EmptyIterator.emptyIterator(); } return new ValuesIterator(parent); } diff --git a/src/java/org/apache/commons/collections/map/LazyMap.java b/src/java/org/apache/commons/collections/map/LazyMap.java index 9d280c292..dc71dd94f 100644 --- a/src/java/org/apache/commons/collections/map/LazyMap.java +++ b/src/java/org/apache/commons/collections/map/LazyMap.java @@ -77,7 +77,7 @@ public class LazyMap extends AbstractMapDecorator implements Map LazyMap getLazyMap(Map map, Factory< ? extends V> factory) { + public static LazyMap lazyMap(Map map, Factory< ? extends V> factory) { return new LazyMap(map, factory); } @@ -88,7 +88,7 @@ public class LazyMap extends AbstractMapDecorator implements Map LazyMap getLazyMap(Map map, Transformer factory) { + public static LazyMap lazyMap(Map map, Transformer factory) { return new LazyMap(map, factory); } @@ -105,7 +105,7 @@ public class LazyMap extends AbstractMapDecorator implements Map /** Serialization version */ private static final long serialVersionUID = 2715322183617658933L; - /** * Factory method to create a lazily instantiated sorted map. * @@ -73,7 +72,7 @@ public class LazySortedMap * @param factory the factory to use, must not be null * @throws IllegalArgumentException if map or factory is null */ - public static SortedMap getLazySortedMap(SortedMap map, Factory factory) { + public static SortedMap lazySortedMap(SortedMap map, Factory factory) { return new LazySortedMap(map, factory); } @@ -84,7 +83,7 @@ public class LazySortedMap * @param factory the factory to use, must not be null * @throws IllegalArgumentException if map or factory is null */ - public static SortedMap getLazySortedMap(SortedMap map, Transformer factory) { + public static SortedMap lazySortedMap(SortedMap map, Transformer factory) { return new LazySortedMap(map, factory); } diff --git a/src/java/org/apache/commons/collections/map/LinkedMap.java b/src/java/org/apache/commons/collections/map/LinkedMap.java index c1ce5aca2..c0c01ce36 100644 --- a/src/java/org/apache/commons/collections/map/LinkedMap.java +++ b/src/java/org/apache/commons/collections/map/LinkedMap.java @@ -283,22 +283,22 @@ public class LinkedMap extends AbstractLinkedMap implements Serializ @Override public Iterator iterator() { - return UnmodifiableIterator.decorate(parent.keySet().iterator()); + return UnmodifiableIterator.unmodifiableIterator(parent.keySet().iterator()); } @Override public ListIterator listIterator() { - return UnmodifiableListIterator.decorate(super.listIterator()); + return UnmodifiableListIterator.umodifiableListIterator(super.listIterator()); } @Override public ListIterator listIterator(int fromIndex) { - return UnmodifiableListIterator.decorate(super.listIterator(fromIndex)); + return UnmodifiableListIterator.umodifiableListIterator(super.listIterator(fromIndex)); } @Override public List subList(int fromIndexInclusive, int toIndexExclusive) { - return UnmodifiableList.decorate(super.subList(fromIndexInclusive, toIndexExclusive)); + return UnmodifiableList.unmodifiableList(super.subList(fromIndexInclusive, toIndexExclusive)); } } diff --git a/src/java/org/apache/commons/collections/map/ListOrderedMap.java b/src/java/org/apache/commons/collections/map/ListOrderedMap.java index 0ac82119d..f5f43aa54 100644 --- a/src/java/org/apache/commons/collections/map/ListOrderedMap.java +++ b/src/java/org/apache/commons/collections/map/ListOrderedMap.java @@ -96,7 +96,7 @@ public class ListOrderedMap * @param map the map to decorate, must not be null * @throws IllegalArgumentException if map is null */ - public static OrderedMap decorate(Map map) { + public static OrderedMap listOrderedMap(Map map) { return new ListOrderedMap(map); } @@ -285,7 +285,7 @@ public class ListOrderedMap * @since Commons Collections 3.2 */ public List keyList() { - return UnmodifiableList.decorate(insertOrder); + return UnmodifiableList.unmodifiableList(insertOrder); } /** diff --git a/src/java/org/apache/commons/collections/map/MultiKeyMap.java b/src/java/org/apache/commons/collections/map/MultiKeyMap.java index 2bf40cc50..17206bc61 100644 --- a/src/java/org/apache/commons/collections/map/MultiKeyMap.java +++ b/src/java/org/apache/commons/collections/map/MultiKeyMap.java @@ -92,7 +92,7 @@ public class MultiKeyMap extends AbstractMapDecorator MultiKeyMap decorate(AbstractHashedMap, V> map) { + public static MultiKeyMap multiKeyMap(AbstractHashedMap, V> map) { if (map == null) { throw new IllegalArgumentException("Map must not be null"); } @@ -112,7 +112,7 @@ public class MultiKeyMap extends AbstractMapDecorator extends AbstractMapDecorator impleme * * @param map the map to wrap */ - @SuppressWarnings("unchecked") - public static MultiValueMap decorate(Map> map) { - return MultiValueMap.decorate((Map) map, ArrayList.class); + @SuppressWarnings({ "unchecked", "rawtypes" }) + public static MultiValueMap multiValueMap(Map> map) { + return MultiValueMap. multiValueMap((Map) map, ArrayList.class); } /** @@ -95,7 +95,7 @@ public class MultiValueMap extends AbstractMapDecorator impleme * @param map the map to wrap * @param collectionClass the type of the collection class */ - public static > MultiValueMap decorate(Map map, Class collectionClass) { + public static > MultiValueMap multiValueMap(Map map, Class collectionClass) { return new MultiValueMap(map, new ReflectionFactory(collectionClass)); } @@ -106,7 +106,7 @@ public class MultiValueMap extends AbstractMapDecorator impleme * @param map the map to decorate * @param collectionFactory the collection factory (must return a Collection object). */ - public static > MultiValueMap decorate(Map map, Factory collectionFactory) { + public static > MultiValueMap multiValueMap(Map map, Factory collectionFactory) { return new MultiValueMap(map, collectionFactory); } @@ -115,9 +115,9 @@ public class MultiValueMap extends AbstractMapDecorator impleme * Creates a MultiValueMap based on a HashMap and * storing the multiple values in an ArrayList. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public MultiValueMap() { - this(new HashMap(), new ReflectionFactory(ArrayList.class)); + this(new HashMap(), new ReflectionFactory(ArrayList.class)); } /** @@ -375,7 +375,7 @@ public class MultiValueMap extends AbstractMapDecorator impleme */ public Iterator iterator(Object key) { if (!containsKey(key)) { - return EmptyIterator.getInstance(); + return EmptyIterator.emptyIterator(); } return new ValuesIterator(key); } diff --git a/src/java/org/apache/commons/collections/map/PredicatedMap.java b/src/java/org/apache/commons/collections/map/PredicatedMap.java index 77ddc9178..68bc64f0c 100644 --- a/src/java/org/apache/commons/collections/map/PredicatedMap.java +++ b/src/java/org/apache/commons/collections/map/PredicatedMap.java @@ -75,7 +75,7 @@ public class PredicatedMap * @param valuePredicate the predicate to validate to values, null means no check * @throws IllegalArgumentException if the map is null */ - public static IterableMap decorate(Map map, Predicate keyPredicate, Predicate valuePredicate) { + public static IterableMap predicatedMap(Map map, Predicate keyPredicate, Predicate valuePredicate) { return new PredicatedMap(map, keyPredicate, valuePredicate); } diff --git a/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java b/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java index 3bbf93a07..b1d631c48 100644 --- a/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java +++ b/src/java/org/apache/commons/collections/map/PredicatedSortedMap.java @@ -62,7 +62,7 @@ public class PredicatedSortedMap extends PredicatedMap implements So * @param valuePredicate the predicate to validate to values, null means no check * @throws IllegalArgumentException if the map is null */ - public static SortedMap decorate(SortedMap map, + public static SortedMap predicatedSortedMap(SortedMap map, Predicate keyPredicate, Predicate valuePredicate) { return new PredicatedSortedMap(map, keyPredicate, valuePredicate); } diff --git a/src/java/org/apache/commons/collections/map/TransformedMap.java b/src/java/org/apache/commons/collections/map/TransformedMap.java index 83d9b100a..f680786bd 100644 --- a/src/java/org/apache/commons/collections/map/TransformedMap.java +++ b/src/java/org/apache/commons/collections/map/TransformedMap.java @@ -65,14 +65,14 @@ public class TransformedMap *

* If there are any elements already in the map being decorated, they * are NOT transformed. - * Contrast this with {@link #decorateTransform}. + * Contrast this with {@link #transformedMap(Map, Transformer, Transformer)}. * * @param map the map to decorate, must not be null * @param keyTransformer the transformer to use for key conversion, null means no transformation * @param valueTransformer the transformer to use for value conversion, null means no transformation * @throws IllegalArgumentException if map is null */ - public static IterableMap decorate(Map map, + public static IterableMap transformingMap(Map map, Transformer keyTransformer, Transformer valueTransformer) { return new TransformedMap(map, keyTransformer, valueTransformer); @@ -84,7 +84,7 @@ public class TransformedMap *

* If there are any elements already in the map being decorated, they * will be transformed by this method. - * Contrast this with {@link #decorate}. + * Contrast this with {@link #transformingMap(Map, Transformer, Transformer)}. * * @param map the map to decorate, must not be null * @param keyTransformer the transformer to use for key conversion, null means no transformation @@ -92,7 +92,7 @@ public class TransformedMap * @throws IllegalArgumentException if map is null * @since Commons Collections 3.2 */ - public static Map decorateTransform(Map map, + public static Map transformedMap(Map map, Transformer keyTransformer, Transformer valueTransformer) { TransformedMap decorated = new TransformedMap(map, keyTransformer, valueTransformer); diff --git a/src/java/org/apache/commons/collections/map/TransformedSortedMap.java b/src/java/org/apache/commons/collections/map/TransformedSortedMap.java index 982850786..42e8892a4 100644 --- a/src/java/org/apache/commons/collections/map/TransformedSortedMap.java +++ b/src/java/org/apache/commons/collections/map/TransformedSortedMap.java @@ -55,14 +55,14 @@ public class TransformedSortedMap *

* If there are any elements already in the map being decorated, they * are NOT transformed. - * Constrast this with {@link #decorateTransform}. + * Contrast this with {@link #transformedSortedMap(SortedMap, Transformer, Transformer)}. * * @param map the map to decorate, must not be null * @param keyTransformer the predicate to validate the keys, null means no transformation * @param valueTransformer the predicate to validate to values, null means no transformation * @throws IllegalArgumentException if the map is null */ - public static SortedMap decorate(SortedMap map, + public static SortedMap transformingSortedMap(SortedMap map, Transformer keyTransformer, Transformer valueTransformer) { return new TransformedSortedMap(map, keyTransformer, valueTransformer); @@ -74,7 +74,7 @@ public class TransformedSortedMap *

* If there are any elements already in the map being decorated, they * will be transformed by this method. - * Constrast this with {@link #decorate}. + * Contrast this with {@link #transformingSortedMap(SortedMap, Transformer, Transformer)}. * * @param map the map to decorate, must not be null * @param keyTransformer the transformer to use for key conversion, null means no transformation @@ -82,7 +82,7 @@ public class TransformedSortedMap * @throws IllegalArgumentException if map is null * @since Commons Collections 3.2 */ - public static SortedMap decorateTransform(SortedMap map, + public static SortedMap transformedSortedMap(SortedMap map, Transformer keyTransformer, Transformer valueTransformer) { TransformedSortedMap decorated = new TransformedSortedMap(map, keyTransformer, valueTransformer); diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java b/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java index e99152250..da6ec7ed8 100644 --- a/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java +++ b/src/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java @@ -49,7 +49,7 @@ public final class UnmodifiableEntrySet * @param set the set to decorate, must not be null * @throws IllegalArgumentException if set is null */ - public static Set> decorate(Set> set) { + public static Set> unmodifiableEntrySet(Set> set) { if (set instanceof Unmodifiable) { return set; } diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableMap.java b/src/java/org/apache/commons/collections/map/UnmodifiableMap.java index 12258cca0..d3136a490 100644 --- a/src/java/org/apache/commons/collections/map/UnmodifiableMap.java +++ b/src/java/org/apache/commons/collections/map/UnmodifiableMap.java @@ -57,7 +57,7 @@ public final class UnmodifiableMap * @param map the map to decorate, must not be null * @throws IllegalArgumentException if map is null */ - public static Map decorate(Map map) { + public static Map unmodifiableMap(Map map) { if (map instanceof Unmodifiable) { return map; } @@ -127,28 +127,28 @@ public final class UnmodifiableMap public MapIterator mapIterator() { if (map instanceof IterableMap) { MapIterator it = ((IterableMap) map).mapIterator(); - return UnmodifiableMapIterator.decorate(it); + return UnmodifiableMapIterator.unmodifiableMapIterator(it); } MapIterator it = new EntrySetMapIterator(map); - return UnmodifiableMapIterator.decorate(it); + return UnmodifiableMapIterator.unmodifiableMapIterator(it); } @Override public Set> entrySet() { Set> set = super.entrySet(); - return UnmodifiableEntrySet.decorate(set); + return UnmodifiableEntrySet.unmodifiableEntrySet(set); } @Override public Set keySet() { Set set = super.keySet(); - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } @Override public Collection values() { Collection coll = super.values(); - return UnmodifiableCollection.decorate(coll); + return UnmodifiableCollection.unmodifiableCollection(coll); } } diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java b/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java index 0a3fa45d6..b2bcee17f 100644 --- a/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java +++ b/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java @@ -55,7 +55,7 @@ public final class UnmodifiableOrderedMap extends AbstractOrderedMapDecora * @param map the map to decorate, must not be null * @throws IllegalArgumentException if map is null */ - public static OrderedMap decorate(OrderedMap map) { + public static OrderedMap unmodifiableOrderedMap(OrderedMap map) { if (map instanceof Unmodifiable) { return map; } @@ -104,7 +104,7 @@ public final class UnmodifiableOrderedMap extends AbstractOrderedMapDecora @Override public OrderedMapIterator mapIterator() { OrderedMapIterator it = decorated().mapIterator(); - return UnmodifiableOrderedMapIterator.decorate(it); + return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it); } @Override @@ -130,19 +130,19 @@ public final class UnmodifiableOrderedMap extends AbstractOrderedMapDecora @Override public Set> entrySet() { Set> set = super.entrySet(); - return UnmodifiableEntrySet.decorate(set); + return UnmodifiableEntrySet.unmodifiableEntrySet(set); } @Override public Set keySet() { Set set = super.keySet(); - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } @Override public Collection values() { Collection coll = super.values(); - return UnmodifiableCollection.decorate(coll); + return UnmodifiableCollection.unmodifiableCollection(coll); } } diff --git a/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java b/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java index 39e69e7d3..61441751c 100644 --- a/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java +++ b/src/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java @@ -55,7 +55,7 @@ public final class UnmodifiableSortedMap * @param map the map to decorate, must not be null * @throws IllegalArgumentException if map is null */ - public static SortedMap decorate(SortedMap map) { + public static SortedMap unmodifiableSortedMap(SortedMap map) { if (map instanceof Unmodifiable) { return map; } @@ -123,17 +123,17 @@ public final class UnmodifiableSortedMap @Override public Set> entrySet() { - return UnmodifiableEntrySet.decorate(super.entrySet()); + return UnmodifiableEntrySet.unmodifiableEntrySet(super.entrySet()); } @Override public Set keySet() { - return UnmodifiableSet.decorate(super.keySet()); + return UnmodifiableSet.unmodifiableSet(super.keySet()); } @Override public Collection values() { - return UnmodifiableCollection.decorate(super.values()); + return UnmodifiableCollection.unmodifiableCollection(super.values()); } //----------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/set/CompositeSet.java b/src/java/org/apache/commons/collections/set/CompositeSet.java index eb95c6e5c..7d0973417 100644 --- a/src/java/org/apache/commons/collections/set/CompositeSet.java +++ b/src/java/org/apache/commons/collections/set/CompositeSet.java @@ -58,7 +58,7 @@ public class CompositeSet extends CompositeCollection implements Set { /** * Create a composite set with sets as the initial set of composited Sets */ - public CompositeSet(Set[] sets) { + public CompositeSet(Set... sets) { super(sets); } diff --git a/src/java/org/apache/commons/collections/set/ListOrderedSet.java b/src/java/org/apache/commons/collections/set/ListOrderedSet.java index a885ad92d..dc760b8d4 100644 --- a/src/java/org/apache/commons/collections/set/ListOrderedSet.java +++ b/src/java/org/apache/commons/collections/set/ListOrderedSet.java @@ -71,7 +71,7 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator imple * @throws IllegalArgumentException if either the set or list is not empty * @since Commons Collections 3.1 */ - public static ListOrderedSet decorate(Set set, List list) { + public static ListOrderedSet listOrderedSet(Set set, List list) { if (set == null) { throw new IllegalArgumentException("Set must not be null"); } @@ -92,7 +92,7 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator imple * @param set the set to decorate, must not be null * @throws IllegalArgumentException if set is null */ - public static ListOrderedSet decorate(Set set) { + public static ListOrderedSet listOrderedSet(Set set) { return new ListOrderedSet(set); } @@ -107,7 +107,7 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator imple * @param list the list to decorate, must not be null * @throws IllegalArgumentException if list is null */ - public static ListOrderedSet decorate(List list) { + public static ListOrderedSet listOrderedSet(List list) { if (list == null) { throw new IllegalArgumentException("List must not be null"); } @@ -164,7 +164,7 @@ public class ListOrderedSet extends AbstractSerializableSetDecorator imple * @return an unmodifiable list view */ public List asList() { - return UnmodifiableList.decorate(setOrder); + return UnmodifiableList.unmodifiableList(setOrder); } //----------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/set/MapBackedSet.java b/src/java/org/apache/commons/collections/set/MapBackedSet.java index c1b150ac2..d1224390d 100644 --- a/src/java/org/apache/commons/collections/set/MapBackedSet.java +++ b/src/java/org/apache/commons/collections/set/MapBackedSet.java @@ -54,8 +54,8 @@ public final class MapBackedSet implements Set, Serializable { * @param map the map to decorate, must not be null * @throws IllegalArgumentException if set is null */ - public static Set decorate(Map map) { - return decorate(map, null); + public static Set mapBackedSet(Map map) { + return mapBackedSet(map, null); } /** @@ -65,7 +65,7 @@ public final class MapBackedSet implements Set, Serializable { * @param dummyValue the dummy value to use * @throws IllegalArgumentException if map is null */ - public static Set decorate(Map map, V dummyValue) { + public static Set mapBackedSet(Map map, V dummyValue) { if (map == null) { throw new IllegalArgumentException("The map must not be null"); } diff --git a/src/java/org/apache/commons/collections/set/PredicatedSet.java b/src/java/org/apache/commons/collections/set/PredicatedSet.java index a40802d47..7080ddf97 100644 --- a/src/java/org/apache/commons/collections/set/PredicatedSet.java +++ b/src/java/org/apache/commons/collections/set/PredicatedSet.java @@ -57,7 +57,7 @@ public class PredicatedSet extends PredicatedCollection implements Set * @throws IllegalArgumentException if set or predicate is null * @throws IllegalArgumentException if the set contains invalid elements */ - public static Set decorate(Set set, Predicate predicate) { + public static Set predicatedSet(Set set, Predicate predicate) { return new PredicatedSet(set, predicate); } diff --git a/src/java/org/apache/commons/collections/set/PredicatedSortedSet.java b/src/java/org/apache/commons/collections/set/PredicatedSortedSet.java index 0e3022733..8dc92513f 100644 --- a/src/java/org/apache/commons/collections/set/PredicatedSortedSet.java +++ b/src/java/org/apache/commons/collections/set/PredicatedSortedSet.java @@ -57,7 +57,7 @@ public class PredicatedSortedSet extends PredicatedSet implements SortedSe * @throws IllegalArgumentException if set or predicate is null * @throws IllegalArgumentException if the set contains invalid elements */ - public static SortedSet decorate(SortedSet set, Predicate predicate) { + public static SortedSet predicatedSortedSet(SortedSet set, Predicate predicate) { return new PredicatedSortedSet(set, predicate); } diff --git a/src/java/org/apache/commons/collections/set/SynchronizedSet.java b/src/java/org/apache/commons/collections/set/SynchronizedSet.java index 464efd60a..fdf3135b5 100644 --- a/src/java/org/apache/commons/collections/set/SynchronizedSet.java +++ b/src/java/org/apache/commons/collections/set/SynchronizedSet.java @@ -44,7 +44,7 @@ public class SynchronizedSet extends SynchronizedCollection implements Set * @param set the set to decorate, must not be null * @throws IllegalArgumentException if set is null */ - public static Set decorate(Set set) { + public static Set synchronizedSet(Set set) { return new SynchronizedSet(set); } diff --git a/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java b/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java index 59a3e1664..a3d83e3cb 100644 --- a/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java +++ b/src/java/org/apache/commons/collections/set/SynchronizedSortedSet.java @@ -45,7 +45,7 @@ public class SynchronizedSortedSet extends SynchronizedCollection implemen * @param set the set to decorate, must not be null * @throws IllegalArgumentException if set is null */ - public static SortedSet decorate(SortedSet set) { + public static SortedSet synchronizedSortedSet(SortedSet set) { return new SynchronizedSortedSet(set); } diff --git a/src/java/org/apache/commons/collections/set/TransformedSet.java b/src/java/org/apache/commons/collections/set/TransformedSet.java index 4a2c08565..80f529211 100644 --- a/src/java/org/apache/commons/collections/set/TransformedSet.java +++ b/src/java/org/apache/commons/collections/set/TransformedSet.java @@ -46,13 +46,13 @@ public class TransformedSet extends TransformedCollection implements Set * If there are any elements already in the set being decorated, they * are NOT transformed. - * Constrast this with {@link #decorateTransform}. + * Contrast this with {@link #transformedSet(Set, Transformer)}. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @throws IllegalArgumentException if set or transformer is null */ - public static Set decorate(Set set, Transformer transformer) { + public static Set transformingSet(Set set, Transformer transformer) { return new TransformedSet(set, transformer); } @@ -62,7 +62,7 @@ public class TransformedSet extends TransformedCollection implements Set * If there are any elements already in the set being decorated, they * will be transformed by this method. - * Constrast this with {@link #decorate}. + * Contrast this with {@link #transformingSet(Set, Transformer)}. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null @@ -70,7 +70,7 @@ public class TransformedSet extends TransformedCollection implements Set Set decorateTransform(Set set, Transformer transformer) { + public static Set transformedSet(Set set, Transformer transformer) { TransformedSet decorated = new TransformedSet(set, transformer); if (transformer != null && set != null && set.size() > 0) { @SuppressWarnings("unchecked") // set is type E diff --git a/src/java/org/apache/commons/collections/set/TransformedSortedSet.java b/src/java/org/apache/commons/collections/set/TransformedSortedSet.java index a0018ecf9..ecd892d1a 100644 --- a/src/java/org/apache/commons/collections/set/TransformedSortedSet.java +++ b/src/java/org/apache/commons/collections/set/TransformedSortedSet.java @@ -46,13 +46,13 @@ public class TransformedSortedSet extends TransformedSet implements Sorted *

* If there are any elements already in the set being decorated, they * are NOT transformed. - * Constrast this with {@link #decorateTransform}. + * Contrast this with {@link #transformedSortedSet(SortedSet, Transformer)}. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @throws IllegalArgumentException if set or transformer is null */ - public static SortedSet decorate(SortedSet set, Transformer transformer) { + public static SortedSet transformingSortedSet(SortedSet set, Transformer transformer) { return new TransformedSortedSet(set, transformer); } @@ -62,7 +62,7 @@ public class TransformedSortedSet extends TransformedSet implements Sorted *

* If there are any elements already in the set being decorated, they * will be transformed by this method. - * Constrast this with {@link #decorate}. + * Contrast this with {@link #transformingSortedSet(SortedSet, Transformer)}. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null @@ -70,7 +70,7 @@ public class TransformedSortedSet extends TransformedSet implements Sorted * @throws IllegalArgumentException if set or transformer is null * @since Commons Collections 3.3 */ - public static SortedSet decorateTransform(SortedSet set, Transformer transformer) { + public static SortedSet transformedSortedSet(SortedSet set, Transformer transformer) { TransformedSortedSet decorated = new TransformedSortedSet(set, transformer); if (transformer != null && set != null && set.size() > 0) { @SuppressWarnings("unchecked") // set is type E diff --git a/src/java/org/apache/commons/collections/set/UnmodifiableSet.java b/src/java/org/apache/commons/collections/set/UnmodifiableSet.java index e79ed02ef..06d65caa8 100644 --- a/src/java/org/apache/commons/collections/set/UnmodifiableSet.java +++ b/src/java/org/apache/commons/collections/set/UnmodifiableSet.java @@ -48,7 +48,7 @@ public final class UnmodifiableSet * @param set the set to decorate, must not be null * @throws IllegalArgumentException if set is null */ - public static Set decorate(Set set) { + public static Set unmodifiableSet(Set set) { if (set instanceof Unmodifiable) { return set; } @@ -69,7 +69,7 @@ public final class UnmodifiableSet //----------------------------------------------------------------------- @Override public Iterator iterator() { - return UnmodifiableIterator.decorate(decorated().iterator()); + return UnmodifiableIterator.unmodifiableIterator(decorated().iterator()); } @Override diff --git a/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java b/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java index 21de5502c..cc3e4f214 100644 --- a/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java +++ b/src/java/org/apache/commons/collections/set/UnmodifiableSortedSet.java @@ -52,7 +52,7 @@ public final class UnmodifiableSortedSet * @param set the set to decorate, must not be null * @throws IllegalArgumentException if set is null */ - public static SortedSet decorate(SortedSet set) { + public static SortedSet unmodifiableSortedSet(SortedSet set) { if (set instanceof Unmodifiable) { return set; } @@ -98,7 +98,7 @@ public final class UnmodifiableSortedSet //----------------------------------------------------------------------- @Override public Iterator iterator() { - return UnmodifiableIterator.decorate(decorated().iterator()); + return UnmodifiableIterator.unmodifiableIterator(decorated().iterator()); } @Override diff --git a/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java b/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java index 7ce439250..e975c8bcf 100644 --- a/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java +++ b/src/java/org/apache/commons/collections/splitmap/AbstractIterableGetMapDecorator.java @@ -29,8 +29,7 @@ import org.apache.commons.collections.map.EntrySetToMapIteratorAdapter; * {@link IterableGet} that uses a {@link Map} for the {@link Get} * implementation. * - * @since Commons Collections 5 - * @TODO fix version + * @since Commons Collections 4.0 * @version $Revision$ $Date$ * * @author Matt Benson diff --git a/src/java/org/apache/commons/collections/splitmap/SplitMapUtils.java b/src/java/org/apache/commons/collections/splitmap/SplitMapUtils.java index 771f6aecd..f5490ef40 100644 --- a/src/java/org/apache/commons/collections/splitmap/SplitMapUtils.java +++ b/src/java/org/apache/commons/collections/splitmap/SplitMapUtils.java @@ -37,8 +37,7 @@ import org.apache.commons.collections.set.UnmodifiableSet; * Utilities for working with "split maps:" objects that implement {@link Put} * and/or {@link Get} but not {@link Map}. * - * @since Commons Collections 5 - * @TODO fix version + * @since Commons Collections 4.0 * @version $Revision$ $Date$ * @see Get * @see Put @@ -53,7 +52,7 @@ public class SplitMapUtils { } private static class WrappedGet implements IterableMap, Unmodifiable { - private Get get; + private final Get get; private WrappedGet(Get get) { this.get = get; @@ -72,7 +71,7 @@ public class SplitMapUtils { } public Set> entrySet() { - return UnmodifiableEntrySet.decorate(get.entrySet()); + return UnmodifiableEntrySet.unmodifiableEntrySet(get.entrySet()); } @Override @@ -97,7 +96,7 @@ public class SplitMapUtils { } public Set keySet() { - return UnmodifiableSet.decorate(get.keySet()); + return UnmodifiableSet.unmodifiableSet(get.keySet()); } public V put(K key, V value) { @@ -117,7 +116,7 @@ public class SplitMapUtils { } public Collection values() { - return UnmodifiableCollection.decorate(get.values()); + return UnmodifiableCollection.unmodifiableCollection(get.values()); } public MapIterator mapIterator() { @@ -127,12 +126,12 @@ public class SplitMapUtils { } else { it = new EntrySetToMapIteratorAdapter(get.entrySet()); } - return UnmodifiableMapIterator.decorate(it); + return UnmodifiableMapIterator.unmodifiableMapIterator(it); } } private static class WrappedPut implements Map, Put { - private Put put; + private final Put put; private WrappedPut(Put put) { this.put = put; diff --git a/src/java/org/apache/commons/collections/splitmap/TransformedMap.java b/src/java/org/apache/commons/collections/splitmap/TransformedMap.java index 8de7516ab..fb8d386e9 100644 --- a/src/java/org/apache/commons/collections/splitmap/TransformedMap.java +++ b/src/java/org/apache/commons/collections/splitmap/TransformedMap.java @@ -49,13 +49,14 @@ import org.apache.commons.collections.map.LinkedMap; * In practice this would often mean >Object, Object>, defeating * much of the usefulness of having parameterized types. *

- * On the downside, this class is not a drop-in replacement for {@link java.util.Map} + * On the downside, this class is not drop-in compatible with {@link java.util.Map} * but is intended to be worked with either directly or by {@link Put} and {@link Get} * generalizations. * - * @since Commons Collections 5 - * @TODO fix version + * @since Commons Collections 4.0 * @version $Revision$ $Date$ + * @see SplitMapUtils#readableMap(Get) + * @see SplitMapUtils#writableMap(Put) * * @author Stephen Colebourne * @author Matt Benson @@ -84,7 +85,7 @@ public class TransformedMap extends AbstractIterableGetMapDecorator< * means no transformation * @throws IllegalArgumentException if map is null */ - public static TransformedMap decorate(Map map, + public static TransformedMap transformingMap(Map map, Transformer keyTransformer, Transformer valueTransformer) { return new TransformedMap(map, keyTransformer, valueTransformer); diff --git a/src/test/org/apache/commons/collections/TestBagUtils.java b/src/test/org/apache/commons/collections/TestBagUtils.java index ed0b35128..41ad9e803 100644 --- a/src/test/org/apache/commons/collections/TestBagUtils.java +++ b/src/test/org/apache/commons/collections/TestBagUtils.java @@ -99,17 +99,17 @@ public class TestBagUtils extends BulkTest { } public void testTransformedBag() { - Bag bag = BagUtils.transformedBag(new HashBag(), nopTransformer); + Bag bag = BagUtils.transformingBag(new HashBag(), nopTransformer); assertTrue("Returned object should be an TransformedBag.", bag instanceof TransformedBag); try { - bag = BagUtils.transformedBag(null, nopTransformer); + bag = BagUtils.transformingBag(null, nopTransformer); fail("Expecting IllegalArgumentException for null bag."); } catch (IllegalArgumentException ex) { // expected } try { - bag = BagUtils.transformedBag(new HashBag(), null); + bag = BagUtils.transformingBag(new HashBag(), null); fail("Expecting IllegalArgumentException for null transformer."); } catch (IllegalArgumentException ex) { // expected @@ -159,17 +159,17 @@ public class TestBagUtils extends BulkTest { } public void testTransformedSortedBag() { - Bag bag = BagUtils.transformedSortedBag(new TreeBag(), nopTransformer); + Bag bag = BagUtils.transformingSortedBag(new TreeBag(), nopTransformer); assertTrue("Returned object should be an TransformedSortedBag", bag instanceof TransformedSortedBag); try { - bag = BagUtils.transformedSortedBag(null, nopTransformer); + bag = BagUtils.transformingSortedBag(null, nopTransformer); fail("Expecting IllegalArgumentException for null bag."); } catch (IllegalArgumentException ex) { // expected } try { - bag = BagUtils.transformedSortedBag(new TreeBag(), null); + bag = BagUtils.transformingSortedBag(new TreeBag(), null); fail("Expecting IllegalArgumentException for null transformer."); } catch (IllegalArgumentException ex) { // expected diff --git a/src/test/org/apache/commons/collections/TestCollectionUtils.java b/src/test/org/apache/commons/collections/TestCollectionUtils.java index a5b3bd42a..448428687 100644 --- a/src/test/org/apache/commons/collections/TestCollectionUtils.java +++ b/src/test/org/apache/commons/collections/TestCollectionUtils.java @@ -1261,16 +1261,16 @@ public class TestCollectionUtils extends MockTestCase { @Test public void testTransformedCollection() { Transformer transformer = TransformerUtils.nopTransformer(); - Collection collection = CollectionUtils.transformedCollection(new ArrayList(), transformer); + Collection collection = CollectionUtils.transformingCollection(new ArrayList(), transformer); assertTrue("returned object should be a TransformedCollection", collection instanceof TransformedCollection); try { - collection = CollectionUtils.transformedCollection(new ArrayList(), null); + collection = CollectionUtils.transformingCollection(new ArrayList(), null); fail("Expecting IllegalArgumentException for null transformer."); } catch (IllegalArgumentException ex) { // expected } try { - collection = CollectionUtils.transformedCollection(null, transformer); + collection = CollectionUtils.transformingCollection(null, transformer); fail("Expecting IllegalArgumentException for null collection."); } catch (IllegalArgumentException ex) { // expected @@ -1283,7 +1283,7 @@ public class TestCollectionUtils extends MockTestCase { list.add("1"); list.add("2"); list.add("3"); - Collection result = CollectionUtils.transformedCollection(list, TRANSFORM_TO_INTEGER); + Collection result = CollectionUtils.transformingCollection(list, TRANSFORM_TO_INTEGER); assertEquals(true, result.contains("1")); // untransformed assertEquals(true, result.contains("2")); // untransformed assertEquals(true, result.contains("3")); // untransformed diff --git a/src/test/org/apache/commons/collections/bag/TestPredicatedBag.java b/src/test/org/apache/commons/collections/bag/TestPredicatedBag.java index ba36c50d3..67b3384ab 100644 --- a/src/test/org/apache/commons/collections/bag/TestPredicatedBag.java +++ b/src/test/org/apache/commons/collections/bag/TestPredicatedBag.java @@ -50,7 +50,7 @@ public class TestPredicatedBag extends AbstractTestBag { protected Predicate truePredicate = TruePredicate.truePredicate(); protected Bag decorateBag(HashBag bag, Predicate predicate) { - return PredicatedBag.decorate(bag, predicate); + return PredicatedBag.predicatedBag(bag, predicate); } @Override diff --git a/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java b/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java index 34e9a2842..2417b021f 100644 --- a/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java +++ b/src/test/org/apache/commons/collections/bag/TestPredicatedSortedBag.java @@ -52,7 +52,7 @@ public class TestPredicatedSortedBag extends AbstractTestSortedBag { protected Predicate truePredicate = TruePredicate.truePredicate(); protected SortedBag decorateBag(SortedBag bag, Predicate predicate) { - return PredicatedSortedBag.decorate(bag, predicate); + return PredicatedSortedBag.predicatedSortedBag(bag, predicate); } @Override diff --git a/src/test/org/apache/commons/collections/bag/TestTransformedBag.java b/src/test/org/apache/commons/collections/bag/TestTransformedBag.java index 2e45cfef6..b501e6ad1 100644 --- a/src/test/org/apache/commons/collections/bag/TestTransformedBag.java +++ b/src/test/org/apache/commons/collections/bag/TestTransformedBag.java @@ -38,13 +38,13 @@ public class TestTransformedBag extends AbstractTestBag { @Override @SuppressWarnings("unchecked") public Bag makeObject() { - return TransformedBag.decorate(new HashBag(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); + return TransformedBag.transformingBag(new HashBag(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); } @SuppressWarnings("unchecked") public void testTransformedBag() { //T had better be Object! - Bag bag = TransformedBag.decorate(new HashBag(), (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Bag bag = TransformedBag.transformingBag(new HashBag(), (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, bag.size()); Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { @@ -65,7 +65,7 @@ public class TestTransformedBag extends AbstractTestBag { for (int i = 0; i < els.length; i++) { originalBag.add(els[i]); } - Bag bag = TransformedBag.decorateTransform(originalBag, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Bag bag = TransformedBag.transformedBag(originalBag, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, bag.size()); for (int i = 0; i < els.length; i++) { assertEquals(true, bag.contains(new Integer((String) els[i]))); diff --git a/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java b/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java index 71cca2a26..15357570b 100644 --- a/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java +++ b/src/test/org/apache/commons/collections/bag/TestTransformedSortedBag.java @@ -39,12 +39,12 @@ public class TestTransformedSortedBag extends AbstractTestSortedBag { @Override @SuppressWarnings("unchecked") public SortedBag makeObject() { - return TransformedSortedBag.decorate(new TreeBag(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); + return TransformedSortedBag.transformingSortedBag(new TreeBag(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); } @SuppressWarnings("unchecked") public void testTransformedBag() { - SortedBag bag = TransformedSortedBag.decorate(new TreeBag(), (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + SortedBag bag = TransformedSortedBag.transformingSortedBag(new TreeBag(), (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, bag.size()); Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { @@ -63,7 +63,7 @@ public class TestTransformedSortedBag extends AbstractTestSortedBag { for (int i = 0; i < els.length; i++) { originalBag.add(els[i]); } - Bag bag = TransformedBag.decorateTransform(originalBag, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Bag bag = TransformedBag.transformedBag(originalBag, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, bag.size()); for (int i = 0; i < els.length; i++) { assertEquals(true, bag.contains(new Integer((String) els[i]))); diff --git a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java index cad8794fe..49647c82c 100644 --- a/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java +++ b/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java @@ -56,13 +56,13 @@ public class TestDualTreeBidiMap2, V extends Comparable< @Override public DualTreeBidiMap makeObject() { return new DualTreeBidiMap( - new ReverseComparator(ComparableComparator. getInstance()), - new ReverseComparator(ComparableComparator. getInstance())); + new ReverseComparator(ComparableComparator. comparableComparator()), + new ReverseComparator(ComparableComparator. comparableComparator())); } @Override public TreeMap makeConfirmedMap() { - return new TreeMap(new ReverseComparator(ComparableComparator.getInstance())); + return new TreeMap(new ReverseComparator(ComparableComparator.comparableComparator())); } public void testComparator() { @@ -132,7 +132,7 @@ public class TestDualTreeBidiMap2, V extends Comparable< // Sort by the comparator used in the makeEmptyBidiMap() method List newSortedKeys = getAsList(getSampleKeys()); - Collections.sort(newSortedKeys, new ReverseComparator(ComparableComparator.getInstance())); + Collections.sort(newSortedKeys, new ReverseComparator(ComparableComparator.comparableComparator())); newSortedKeys = Collections.unmodifiableList(newSortedKeys); Iterator mapIter = sm.keySet().iterator(); diff --git a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableBidiMap.java index e1600fcc2..1e0d11312 100644 --- a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableBidiMap.java +++ b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableBidiMap.java @@ -42,14 +42,14 @@ public class TestUnmodifiableBidiMap extends AbstractTestBidiMap { @Override public BidiMap makeObject() { - return UnmodifiableBidiMap.decorate(new DualHashBidiMap()); + return UnmodifiableBidiMap.unmodifiableBidiMap(new DualHashBidiMap()); } @Override public BidiMap makeFullMap() { BidiMap bidi = new DualHashBidiMap(); addSampleMappings(bidi); - return UnmodifiableBidiMap.decorate(bidi); + return UnmodifiableBidiMap.unmodifiableBidiMap(bidi); } @Override diff --git a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableOrderedBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableOrderedBidiMap.java index 1ed372011..dabc4fa59 100644 --- a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableOrderedBidiMap.java +++ b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableOrderedBidiMap.java @@ -43,14 +43,14 @@ public class TestUnmodifiableOrderedBidiMap, V extends C @Override public OrderedBidiMap makeObject() { - return UnmodifiableOrderedBidiMap.decorate(new TreeBidiMap()); + return UnmodifiableOrderedBidiMap.unmodifiableOrderedBidiMap(new TreeBidiMap()); } @Override public BidiMap makeFullMap() { OrderedBidiMap bidi = new TreeBidiMap(); addSampleMappings(bidi); - return UnmodifiableOrderedBidiMap.decorate(bidi); + return UnmodifiableOrderedBidiMap.unmodifiableOrderedBidiMap(bidi); } @Override diff --git a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableSortedBidiMap.java b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableSortedBidiMap.java index 2d7645a54..6637c6186 100644 --- a/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableSortedBidiMap.java +++ b/src/test/org/apache/commons/collections/bidimap/TestUnmodifiableSortedBidiMap.java @@ -43,14 +43,14 @@ public class TestUnmodifiableSortedBidiMap, V extends Co //----------------------------------------------------------------------- @Override public SortedBidiMap makeObject() { - return UnmodifiableSortedBidiMap.decorate(new DualTreeBidiMap()); + return UnmodifiableSortedBidiMap.unmodifiableSortedBidiMap(new DualTreeBidiMap()); } @Override public SortedBidiMap makeFullMap() { SortedBidiMap bidi = new DualTreeBidiMap(); addSampleMappings(bidi); - return UnmodifiableSortedBidiMap.decorate(bidi); + return UnmodifiableSortedBidiMap.unmodifiableSortedBidiMap(bidi); } @Override diff --git a/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java b/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java index 1c8689f5b..e77b12fc0 100644 --- a/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java +++ b/src/test/org/apache/commons/collections/buffer/TestBlockingBuffer.java @@ -43,7 +43,7 @@ public class TestBlockingBuffer extends AbstractTestObject { @Override public Buffer makeObject() { - return BlockingBuffer.decorate(new MyBuffer()); + return BlockingBuffer.blockingBuffer(new MyBuffer()); } @Override @@ -72,7 +72,7 @@ public class TestBlockingBuffer extends AbstractTestObject { } public void testGetWithAddTimeout() { - Buffer blockingBuffer = BlockingBuffer.decorate(new MyBuffer(), 500); + Buffer blockingBuffer = BlockingBuffer.blockingBuffer(new MyBuffer(), 500); E obj = makeElement(); new DelayedAdd(blockingBuffer, obj, 100).start(); @@ -96,7 +96,7 @@ public class TestBlockingBuffer extends AbstractTestObject { } public void testGetWithAddAllTimeout() { - Buffer blockingBuffer = BlockingBuffer.decorate(new MyBuffer(), 500); + Buffer blockingBuffer = BlockingBuffer.blockingBuffer(new MyBuffer(), 500); E obj = makeElement(); new DelayedAddAll(blockingBuffer, obj, 100).start(); @@ -120,7 +120,7 @@ public class TestBlockingBuffer extends AbstractTestObject { } public void testRemoveWithAddTimeout() { - Buffer blockingBuffer = BlockingBuffer.decorate(new MyBuffer(), 100); + Buffer blockingBuffer = BlockingBuffer.blockingBuffer(new MyBuffer(), 100); E obj = makeElement(); new DelayedAdd(blockingBuffer, obj, 500).start(); try { @@ -145,7 +145,7 @@ public class TestBlockingBuffer extends AbstractTestObject { } public void testRemoveWithAddAllTimeout() { - Buffer blockingBuffer = BlockingBuffer.decorate(new MyBuffer(), 100); + Buffer blockingBuffer = BlockingBuffer.blockingBuffer(new MyBuffer(), 100); E obj = makeElement(); new DelayedAddAll(blockingBuffer, obj, 500).start(); try { diff --git a/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java b/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java index 52e66ebbf..ac9b300f2 100644 --- a/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java +++ b/src/test/org/apache/commons/collections/buffer/TestBoundedBuffer.java @@ -43,13 +43,13 @@ public class TestBoundedBuffer extends AbstractTestObject { @Override public Buffer makeObject() { - return BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1); + return BoundedBuffer.boundedBuffer(new UnboundedFifoBuffer(), 1); } //----------------------------------------------------------------------- @SuppressWarnings("unchecked") public void testMaxSize() { - final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 2, 500); + final Buffer bounded = BoundedBuffer.boundedBuffer(new UnboundedFifoBuffer(), 2, 500); BoundedCollection bc = (BoundedCollection) bounded; assertEquals(2, bc.maxSize()); assertEquals(false, bc.isFull()); @@ -60,11 +60,11 @@ public class TestBoundedBuffer extends AbstractTestObject { bounded.remove(); assertEquals(false, bc.isFull()); try { - BoundedBuffer.decorate(new UnboundedFifoBuffer(), 0); + BoundedBuffer.boundedBuffer(new UnboundedFifoBuffer(), 0); fail(); } catch (IllegalArgumentException ex) {} try { - BoundedBuffer.decorate(new UnboundedFifoBuffer(), -1); + BoundedBuffer.boundedBuffer(new UnboundedFifoBuffer(), -1); fail(); } catch (IllegalArgumentException ex) {} } @@ -103,7 +103,7 @@ public class TestBoundedBuffer extends AbstractTestObject { @SuppressWarnings("unchecked") public void testAddToFullBufferRemoveViaIterator() { - final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1, 500); + final Buffer bounded = BoundedBuffer.boundedBuffer(new UnboundedFifoBuffer(), 1, 500); bounded.add((E) "Hello"); new DelayedIteratorRemove(bounded, 200).start(); bounded.add((E) "World"); @@ -114,7 +114,7 @@ public class TestBoundedBuffer extends AbstractTestObject { @SuppressWarnings("unchecked") public void testAddAllToFullBufferRemoveViaIterator() { - final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 2, 500); + final Buffer bounded = BoundedBuffer.boundedBuffer(new UnboundedFifoBuffer(), 2, 500); bounded.add((E) "Hello"); bounded.add((E) "World"); new DelayedIteratorRemove(bounded, 200, 2).start(); @@ -126,7 +126,7 @@ public class TestBoundedBuffer extends AbstractTestObject { @SuppressWarnings("unchecked") public void testAddToFullBufferWithTimeout() { - final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 1, 500); + final Buffer bounded = BoundedBuffer.boundedBuffer(new UnboundedFifoBuffer(), 1, 500); bounded.add((E) "Hello"); new DelayedRemove(bounded, 200).start(); bounded.add((E) "World"); @@ -141,7 +141,7 @@ public class TestBoundedBuffer extends AbstractTestObject { @SuppressWarnings("unchecked") public void testAddAllToFullBufferWithTimeout() { - final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 2, 500); + final Buffer bounded = BoundedBuffer.boundedBuffer(new UnboundedFifoBuffer(), 2, 500); bounded.add((E) "Hello"); bounded.add((E) "World"); new DelayedRemove(bounded, 200, 2).start(); diff --git a/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.java b/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.java index 0fe8f8b9e..041dbcdc7 100644 --- a/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.java +++ b/src/test/org/apache/commons/collections/buffer/TestPredicatedBuffer.java @@ -42,7 +42,7 @@ public class TestPredicatedBuffer extends TestPredicatedCollection { //--------------------------------------------------------------- protected Buffer decorateCollection(Buffer buffer, Predicate predicate) { - return PredicatedBuffer.decorate(buffer, predicate); + return PredicatedBuffer.predicatedBuffer(buffer, predicate); } @Override diff --git a/src/test/org/apache/commons/collections/buffer/TestSynchronizedBuffer.java b/src/test/org/apache/commons/collections/buffer/TestSynchronizedBuffer.java index 88f7aa5f8..377aea88e 100644 --- a/src/test/org/apache/commons/collections/buffer/TestSynchronizedBuffer.java +++ b/src/test/org/apache/commons/collections/buffer/TestSynchronizedBuffer.java @@ -42,14 +42,14 @@ public class TestSynchronizedBuffer extends AbstractTestCollection { //----------------------------------------------------------------------- @Override public Buffer makeObject() { - return SynchronizedBuffer.decorate(new UnboundedFifoBuffer()); + return SynchronizedBuffer.synchronizedBuffer(new UnboundedFifoBuffer()); } @Override public Collection makeFullCollection() { Buffer buffer = new UnboundedFifoBuffer(); buffer.addAll(Arrays.asList(getFullElements())); - return SynchronizedBuffer.decorate(buffer); + return SynchronizedBuffer.synchronizedBuffer(buffer); } @Override diff --git a/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java b/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java index 70f1e3eab..cd8a45846 100644 --- a/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java +++ b/src/test/org/apache/commons/collections/buffer/TestTransformedBuffer.java @@ -37,7 +37,7 @@ public class TestTransformedBuffer extends TestCase { } public void testTransformedBuffer() { - Buffer buffer = TransformedBuffer.decorate(new ArrayStack(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Buffer buffer = TransformedBuffer.transformingBuffer(new ArrayStack(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, buffer.size()); Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" }; for (int i = 0; i < els.length; i++) { @@ -58,7 +58,7 @@ public class TestTransformedBuffer extends TestCase { for (int i = 0; i < els.length; i++) { originalBuffer.add(els[i]); } - Buffer buffer = TransformedBuffer.decorateTransform(originalBuffer, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Buffer buffer = TransformedBuffer.transformedBuffer(originalBuffer, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, buffer.size()); for (int i = 0; i < els.length; i++) { assertEquals(true, buffer.contains(new Integer((String) els[i]))); diff --git a/src/test/org/apache/commons/collections/buffer/TestUnmodifiableBuffer.java b/src/test/org/apache/commons/collections/buffer/TestUnmodifiableBuffer.java index 55f105604..1cb355951 100644 --- a/src/test/org/apache/commons/collections/buffer/TestUnmodifiableBuffer.java +++ b/src/test/org/apache/commons/collections/buffer/TestUnmodifiableBuffer.java @@ -42,14 +42,14 @@ public class TestUnmodifiableBuffer extends AbstractTestCollection { //----------------------------------------------------------------------- @Override public Collection makeObject() { - return UnmodifiableBuffer.decorate(new UnboundedFifoBuffer()); + return UnmodifiableBuffer.unmodifiableBuffer(new UnboundedFifoBuffer()); } @Override public Collection makeFullCollection() { Buffer buffer = new UnboundedFifoBuffer(); buffer.addAll(Arrays.asList(getFullElements())); - return UnmodifiableBuffer.decorate(buffer); + return UnmodifiableBuffer.unmodifiableBuffer(buffer); } @Override diff --git a/src/test/org/apache/commons/collections/collection/TestPredicatedCollection.java b/src/test/org/apache/commons/collections/collection/TestPredicatedCollection.java index 705606f8f..c69532e08 100644 --- a/src/test/org/apache/commons/collections/collection/TestPredicatedCollection.java +++ b/src/test/org/apache/commons/collections/collection/TestPredicatedCollection.java @@ -44,7 +44,7 @@ public class TestPredicatedCollection extends AbstractTestCollection { protected Collection decorateCollection( Collection collection, Predicate predicate) { - return PredicatedCollection.decorate(collection, predicate); + return PredicatedCollection.predicatedCollection(collection, predicate); } @Override diff --git a/src/test/org/apache/commons/collections/collection/TestSynchronizedCollection.java b/src/test/org/apache/commons/collections/collection/TestSynchronizedCollection.java index 83656652c..3c9ebfaf6 100644 --- a/src/test/org/apache/commons/collections/collection/TestSynchronizedCollection.java +++ b/src/test/org/apache/commons/collections/collection/TestSynchronizedCollection.java @@ -39,7 +39,7 @@ public class TestSynchronizedCollection extends AbstractTestCollection { //----------------------------------------------------------------------- @Override public Collection makeObject() { - return SynchronizedCollection.decorate(new ArrayList()); + return SynchronizedCollection.synchronizedCollection(new ArrayList()); } @Override diff --git a/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java b/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java index 22ef478da..74b56d8d0 100644 --- a/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java +++ b/src/test/org/apache/commons/collections/collection/TestTransformedCollection.java @@ -63,14 +63,14 @@ public class TestTransformedCollection extends AbstractTestCollection { @Override public Collection makeObject() { - return TransformedCollection.decorate(new ArrayList(), NOOP_TRANSFORMER); + return TransformedCollection.transformingCollection(new ArrayList(), NOOP_TRANSFORMER); } @Override public Collection makeFullCollection() { List list = new ArrayList(); list.addAll(Arrays.asList(getFullElements())); - return TransformedCollection.decorate(list, NOOP_TRANSFORMER); + return TransformedCollection.transformingCollection(list, NOOP_TRANSFORMER); } //----------------------------------------------------------------------- @@ -86,7 +86,7 @@ public class TestTransformedCollection extends AbstractTestCollection { //----------------------------------------------------------------------- public void testTransformedCollection() { - Collection coll = TransformedCollection.decorate(new ArrayList(), STRING_TO_INTEGER_TRANSFORMER); + Collection coll = TransformedCollection.transformingCollection(new ArrayList(), STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, coll.size()); Object[] els = getFullElements(); for (int i = 0; i < els.length; i++) { @@ -105,7 +105,7 @@ public class TestTransformedCollection extends AbstractTestCollection { for (int i = 0; i < els.length; i++) { originalCollection.add(els[i]); } - Collection collection = TransformedCollection.decorateTransform(originalCollection, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Collection collection = TransformedCollection.transformedCollection(originalCollection, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, collection.size()); for (int i = 0; i < els.length; i++) { assertEquals(true, collection.contains(new Integer((String) els[i]))); diff --git a/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java b/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java index 844b7881e..9c9f8ca59 100644 --- a/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java +++ b/src/test/org/apache/commons/collections/collection/TestUnmodifiableCollection.java @@ -40,14 +40,14 @@ public class TestUnmodifiableCollection extends AbstractTestCollection { //----------------------------------------------------------------------- @Override public Collection makeObject() { - return UnmodifiableCollection.decorate(new ArrayList()); + return UnmodifiableCollection.unmodifiableCollection(new ArrayList()); } @Override public Collection makeFullCollection() { List list = new ArrayList(); list.addAll(Arrays.asList(getFullElements())); - return UnmodifiableCollection.decorate(list); + return UnmodifiableCollection.unmodifiableCollection(list); } @Override diff --git a/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.java b/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.java index bbad7a84f..91732f7f9 100644 --- a/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.java +++ b/src/test/org/apache/commons/collections/comparators/TestBooleanComparator.java @@ -73,20 +73,20 @@ public class TestBooleanComparator extends AbstractTestComparator { public void testStaticFactoryMethods() { allTests(false,BooleanComparator.getFalseFirstComparator()); - allTests(false,BooleanComparator.getBooleanComparator(false)); + allTests(false,BooleanComparator.booleanComparator(false)); allTests(true,BooleanComparator.getTrueFirstComparator()); - allTests(true,BooleanComparator.getBooleanComparator(true)); + allTests(true,BooleanComparator.booleanComparator(true)); } public void testEqualsCompatibleInstance() { assertEquals(new BooleanComparator(),new BooleanComparator(false)); assertEquals(new BooleanComparator(false),new BooleanComparator(false)); assertEquals(new BooleanComparator(false),BooleanComparator.getFalseFirstComparator()); - assertSame(BooleanComparator.getFalseFirstComparator(),BooleanComparator.getBooleanComparator(false)); + assertSame(BooleanComparator.getFalseFirstComparator(),BooleanComparator.booleanComparator(false)); assertEquals(new BooleanComparator(true),new BooleanComparator(true)); assertEquals(new BooleanComparator(true),BooleanComparator.getTrueFirstComparator()); - assertSame(BooleanComparator.getTrueFirstComparator(),BooleanComparator.getBooleanComparator(true)); + assertSame(BooleanComparator.getTrueFirstComparator(),BooleanComparator.booleanComparator(true)); assertTrue(!(new BooleanComparator().equals(new BooleanComparator(true)))); assertTrue(!(new BooleanComparator(true).equals(new BooleanComparator(false)))); diff --git a/src/test/org/apache/commons/collections/functors/TestComparatorPredicate.java b/src/test/org/apache/commons/collections/functors/TestComparatorPredicate.java index b3d66d369..8bcd9b724 100644 --- a/src/test/org/apache/commons/collections/functors/TestComparatorPredicate.java +++ b/src/test/org/apache/commons/collections/functors/TestComparatorPredicate.java @@ -33,7 +33,7 @@ public class TestComparatorPredicate extends BasicPredicateTestBase { @Test public void compareEquals() { Integer value = Integer.valueOf(10); - Predicate p = getInstance(value, new TestComparator()); + Predicate p = comparatorPredicate(value, new TestComparator()); assertFalse(p, Integer.valueOf(value.intValue() - 1)); assertTrue(p, Integer.valueOf(value.intValue())); assertFalse(p, Integer.valueOf(value.intValue() + 1)); @@ -42,7 +42,7 @@ public class TestComparatorPredicate extends BasicPredicateTestBase { @Test public void compareGreater() { Integer value = Integer.valueOf(10); - Predicate p = getInstance(value, new TestComparator(), Criterion.GREATER); + Predicate p = comparatorPredicate(value, new TestComparator(), Criterion.GREATER); assertTrue(p, Integer.valueOf(value.intValue() - 1)); assertFalse(p, Integer.valueOf(value.intValue())); assertFalse(p, Integer.valueOf(value.intValue() + 1)); @@ -51,7 +51,7 @@ public class TestComparatorPredicate extends BasicPredicateTestBase { @Test public void compareLess() { Integer value = Integer.valueOf(10); - Predicate p = getInstance(value, new TestComparator(), Criterion.LESS); + Predicate p = comparatorPredicate(value, new TestComparator(), Criterion.LESS); assertFalse(p, Integer.valueOf(value.intValue() - 1)); assertFalse(p, Integer.valueOf(value.intValue())); assertTrue(p, Integer.valueOf(value.intValue() + 1)); @@ -60,7 +60,7 @@ public class TestComparatorPredicate extends BasicPredicateTestBase { @Test public void compareGreaterOrEqual() { Integer value = Integer.valueOf(10); - Predicate p = getInstance(value, new TestComparator(), Criterion.GREATER_OR_EQUAL); + Predicate p = comparatorPredicate(value, new TestComparator(), Criterion.GREATER_OR_EQUAL); assertTrue(p, Integer.valueOf(value.intValue() - 1)); assertTrue(p, Integer.valueOf(value.intValue())); assertFalse(p, Integer.valueOf(value.intValue() + 1)); @@ -69,7 +69,7 @@ public class TestComparatorPredicate extends BasicPredicateTestBase { @Test public void compareLessOrEqual() { Integer value = Integer.valueOf(10); - Predicate p = getInstance(value, new TestComparator(), Criterion.LESS_OR_EQUAL); + Predicate p = comparatorPredicate(value, new TestComparator(), Criterion.LESS_OR_EQUAL); assertFalse(p, Integer.valueOf(value.intValue() - 1)); assertTrue(p, Integer.valueOf(value.intValue())); assertTrue(p, Integer.valueOf(value.intValue() + 1)); @@ -77,6 +77,6 @@ public class TestComparatorPredicate extends BasicPredicateTestBase { @Override protected Predicate generatePredicate() { - return getInstance(Integer.valueOf(10), new TestComparator()); + return comparatorPredicate(Integer.valueOf(10), new TestComparator()); } } diff --git a/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java b/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java index dd9e303b4..3de60b653 100644 --- a/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java +++ b/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java @@ -145,7 +145,7 @@ public class TestFilterIterator extends AbstractTestIterator { assertEquals(true, filterIterator.hasNext()); // this predicate doesn't match - filterIterator.setPredicate(NotNullPredicate.getInstance()); + filterIterator.setPredicate(NotNullPredicate.notNullPredicate()); assertEquals(false, filterIterator.hasNext()); } diff --git a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableIterator.java b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableIterator.java index c4a8199f6..b5163dae3 100644 --- a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableIterator.java +++ b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableIterator.java @@ -52,12 +52,12 @@ public class TestUnmodifiableIterator extends AbstractTestIterator { @Override public Iterator makeEmptyIterator() { - return UnmodifiableIterator.decorate(Collections.emptyList().iterator()); + return UnmodifiableIterator.unmodifiableIterator(Collections.emptyList().iterator()); } @Override public Iterator makeObject() { - return UnmodifiableIterator.decorate(testList.iterator()); + return UnmodifiableIterator.unmodifiableIterator(testList.iterator()); } @Override @@ -72,13 +72,13 @@ public class TestUnmodifiableIterator extends AbstractTestIterator { public void testDecorateFactory() { Iterator it = makeObject(); - assertSame(it, UnmodifiableIterator.decorate(it)); + assertSame(it, UnmodifiableIterator.unmodifiableIterator(it)); it = testList.iterator(); - assertTrue(it != UnmodifiableIterator.decorate(it)); + assertTrue(it != UnmodifiableIterator.unmodifiableIterator(it)); try { - UnmodifiableIterator.decorate(null); + UnmodifiableIterator.unmodifiableIterator(null); fail(); } catch (IllegalArgumentException ex) {} } diff --git a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableListIterator.java b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableListIterator.java index cc515b7ee..1a0df152d 100644 --- a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableListIterator.java +++ b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableListIterator.java @@ -52,12 +52,12 @@ public class TestUnmodifiableListIterator extends AbstractTestListIterator @Override public ListIterator makeEmptyIterator() { - return UnmodifiableListIterator.decorate(Collections.emptyList().listIterator()); + return UnmodifiableListIterator.umodifiableListIterator(Collections.emptyList().listIterator()); } @Override public ListIterator makeObject() { - return UnmodifiableListIterator.decorate(testList.listIterator()); + return UnmodifiableListIterator.umodifiableListIterator(testList.listIterator()); } @Override @@ -82,13 +82,13 @@ public class TestUnmodifiableListIterator extends AbstractTestListIterator public void testDecorateFactory() { ListIterator it = makeObject(); - assertSame(it, UnmodifiableListIterator.decorate(it)); + assertSame(it, UnmodifiableListIterator.umodifiableListIterator(it)); it = testList.listIterator(); - assertTrue(it != UnmodifiableListIterator.decorate(it)); + assertTrue(it != UnmodifiableListIterator.umodifiableListIterator(it)); try { - UnmodifiableListIterator.decorate(null); + UnmodifiableListIterator.umodifiableListIterator(null); fail(); } catch (IllegalArgumentException ex) {} } diff --git a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java index 658f14f85..1ebf6fbd6 100644 --- a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java +++ b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java @@ -39,12 +39,12 @@ public class TestUnmodifiableMapIterator extends AbstractTestMapIterator makeEmptyIterator() { - return UnmodifiableMapIterator.decorate(new DualHashBidiMap().mapIterator()); + return UnmodifiableMapIterator.unmodifiableMapIterator(new DualHashBidiMap().mapIterator()); } @Override public MapIterator makeObject() { - return UnmodifiableMapIterator.decorate(getMap().mapIterator()); + return UnmodifiableMapIterator.unmodifiableMapIterator(getMap().mapIterator()); } @Override @@ -84,13 +84,13 @@ public class TestUnmodifiableMapIterator extends AbstractTestMapIterator it = makeObject(); - assertSame(it, UnmodifiableMapIterator.decorate(it)); + assertSame(it, UnmodifiableMapIterator.unmodifiableMapIterator(it)); it = getMap().mapIterator() ; - assertTrue(it != UnmodifiableMapIterator.decorate(it)); + assertTrue(it != UnmodifiableMapIterator.unmodifiableMapIterator(it)); try { - UnmodifiableMapIterator.decorate(null); + UnmodifiableMapIterator.unmodifiableMapIterator(null); fail(); } catch (IllegalArgumentException ex) {} } diff --git a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.java b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.java index c46b5b130..a26277463 100644 --- a/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.java +++ b/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.java @@ -40,19 +40,19 @@ public class TestUnmodifiableOrderedMapIterator extends AbstractTestOrdere @Override public OrderedMapIterator makeEmptyIterator() { - return UnmodifiableOrderedMapIterator.decorate( - ListOrderedMap.decorate(new HashMap()).mapIterator()); + return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator( + ListOrderedMap.listOrderedMap(new HashMap()).mapIterator()); } @Override public OrderedMapIterator makeObject() { - return UnmodifiableOrderedMapIterator.decorate(getMap().mapIterator()); + return UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(getMap().mapIterator()); } @Override @SuppressWarnings("unchecked") public OrderedMap getMap() { - OrderedMap testMap = ListOrderedMap.decorate(new HashMap()); + OrderedMap testMap = ListOrderedMap.listOrderedMap(new HashMap()); testMap.put((K) "A", (V) "a"); testMap.put((K) "B", (V) "b"); testMap.put((K) "C", (V) "c"); @@ -86,13 +86,13 @@ public class TestUnmodifiableOrderedMapIterator extends AbstractTestOrdere public void testDecorateFactory() { OrderedMapIterator it = makeObject(); - assertSame(it, UnmodifiableOrderedMapIterator.decorate(it)); + assertSame(it, UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it)); it = getMap().mapIterator() ; - assertTrue(it != UnmodifiableOrderedMapIterator.decorate(it)); + assertTrue(it != UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it)); try { - UnmodifiableOrderedMapIterator.decorate(null); + UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(null); fail(); } catch (IllegalArgumentException ex) {} } diff --git a/src/test/org/apache/commons/collections/list/TestFixedSizeList.java b/src/test/org/apache/commons/collections/list/TestFixedSizeList.java index 640952c24..3475d75d0 100644 --- a/src/test/org/apache/commons/collections/list/TestFixedSizeList.java +++ b/src/test/org/apache/commons/collections/list/TestFixedSizeList.java @@ -37,14 +37,14 @@ public class TestFixedSizeList extends AbstractTestList { @Override public List makeObject() { - return FixedSizeList.decorate(new ArrayList()); + return FixedSizeList.fixedSizeList(new ArrayList()); } @Override public List makeFullCollection() { List list = new ArrayList(); list.addAll(Arrays.asList(getFullElements())); - return FixedSizeList.decorate(list); + return FixedSizeList.fixedSizeList(list); } @Override diff --git a/src/test/org/apache/commons/collections/list/TestGrowthList.java b/src/test/org/apache/commons/collections/list/TestGrowthList.java index f21ed9963..5ecdc4ffa 100644 --- a/src/test/org/apache/commons/collections/list/TestGrowthList.java +++ b/src/test/org/apache/commons/collections/list/TestGrowthList.java @@ -44,7 +44,7 @@ public class TestGrowthList extends AbstractTestList { public List makeFullCollection() { List list = new ArrayList(); list.addAll(Arrays.asList(getFullElements())); - return GrowthList.decorate(list); + return GrowthList.growthList(list); } //----------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/list/TestPredicatedList.java b/src/test/org/apache/commons/collections/list/TestPredicatedList.java index 4c2fb6ea3..ef18dbb07 100644 --- a/src/test/org/apache/commons/collections/list/TestPredicatedList.java +++ b/src/test/org/apache/commons/collections/list/TestPredicatedList.java @@ -42,7 +42,7 @@ public class TestPredicatedList extends AbstractTestList { protected Predicate truePredicate = TruePredicate.truePredicate(); protected List decorateList(List list, Predicate predicate) { - return PredicatedList.decorate(list, predicate); + return PredicatedList.predicatedList(list, predicate); } @Override diff --git a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java index 88db03738..82f9c2e5c 100644 --- a/src/test/org/apache/commons/collections/list/TestSetUniqueList.java +++ b/src/test/org/apache/commons/collections/list/TestSetUniqueList.java @@ -214,7 +214,7 @@ public class TestSetUniqueList extends AbstractTestList { public void testFactory() { Integer[] array = new Integer[] { new Integer(1), new Integer(2), new Integer(1) }; ArrayList list = new ArrayList(Arrays.asList(array)); - final SetUniqueList lset = SetUniqueList.decorate(list); + final SetUniqueList lset = SetUniqueList.setUniqueList(list); assertEquals("Duplicate element was added.", 2, lset.size()); assertEquals(new Integer(1), lset.get(0)); @@ -311,7 +311,7 @@ public class TestSetUniqueList extends AbstractTestList { @SuppressWarnings("unchecked") public void testUniqueListReInsert() { - List l = SetUniqueList.decorate(new LinkedList()); + List l = SetUniqueList.setUniqueList(new LinkedList()); l.add((E) new Object()); l.add((E) new Object()); @@ -328,7 +328,7 @@ public class TestSetUniqueList extends AbstractTestList { @SuppressWarnings("unchecked") public void testUniqueListDoubleInsert() { - List l = SetUniqueList.decorate(new LinkedList()); + List l = SetUniqueList.setUniqueList(new LinkedList()); l.add((E) new Object()); l.add((E) new Object()); @@ -458,7 +458,7 @@ public class TestSetUniqueList extends AbstractTestList { // TODO: Generics public void testCollections304() { List list = new LinkedList(); - SetUniqueList decoratedList = SetUniqueList.decorate(list); + SetUniqueList decoratedList = SetUniqueList.setUniqueList(list); String s1 = "Apple"; String s2 = "Lemon"; String s3 = "Orange"; @@ -486,7 +486,7 @@ public class TestSetUniqueList extends AbstractTestList { @SuppressWarnings("unchecked") public void testCollections307() { List list = new ArrayList(); - List uniqueList = SetUniqueList.decorate(list); + List uniqueList = SetUniqueList.setUniqueList(list); String hello = "Hello"; String world = "World"; diff --git a/src/test/org/apache/commons/collections/list/TestSynchronizedList.java b/src/test/org/apache/commons/collections/list/TestSynchronizedList.java index e2c12171b..ffcdf8c09 100644 --- a/src/test/org/apache/commons/collections/list/TestSynchronizedList.java +++ b/src/test/org/apache/commons/collections/list/TestSynchronizedList.java @@ -41,7 +41,7 @@ public class TestSynchronizedList extends AbstractTestList { @Override public List makeObject() { - return SynchronizedList.decorate(new ArrayList()); + return SynchronizedList.synchronizedList(new ArrayList()); } @Override diff --git a/src/test/org/apache/commons/collections/list/TestTransformedList.java b/src/test/org/apache/commons/collections/list/TestTransformedList.java index 413ee122c..68aa50ee9 100644 --- a/src/test/org/apache/commons/collections/list/TestTransformedList.java +++ b/src/test/org/apache/commons/collections/list/TestTransformedList.java @@ -54,7 +54,7 @@ public class TestTransformedList extends AbstractTestList { @Override @SuppressWarnings("unchecked") public List makeObject() { - return TransformedList.decorate(new ArrayList(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); + return TransformedList.transformingList(new ArrayList(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); } @Override @@ -62,12 +62,12 @@ public class TestTransformedList extends AbstractTestList { public List makeFullCollection() { List list = new ArrayList(); list.addAll(Arrays.asList(getFullElements())); - return TransformedList.decorate(list, (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); + return TransformedList.transformingList(list, (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); } @SuppressWarnings("unchecked") public void testTransformedList() { - List list = TransformedList.decorate(new ArrayList(), (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + List list = TransformedList.transformingList(new ArrayList(), (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, list.size()); E[] els = (E[]) new Object[] {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { @@ -119,7 +119,7 @@ public class TestTransformedList extends AbstractTestList { for (int i = 0; i < els.length; i++) { originalList.add(els[i]); } - List list = TransformedList.decorateTransform(originalList, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + List list = TransformedList.transformedList(originalList, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, list.size()); for (int i = 0; i < els.length; i++) { assertEquals(true, list.contains(new Integer((String) els[i]))); diff --git a/src/test/org/apache/commons/collections/map/TestDefaultedMap.java b/src/test/org/apache/commons/collections/map/TestDefaultedMap.java index 60d535ebd..aba26dbe9 100644 --- a/src/test/org/apache/commons/collections/map/TestDefaultedMap.java +++ b/src/test/org/apache/commons/collections/map/TestDefaultedMap.java @@ -45,7 +45,7 @@ public class TestDefaultedMap extends AbstractTestIterableMap { //----------------------------------------------------------------------- @Override public IterableMap makeObject() { - return DefaultedMap.decorate(new HashMap(), nullFactory); + return DefaultedMap.defaultedMap(new HashMap(), nullFactory); } //----------------------------------------------------------------------- @@ -69,7 +69,7 @@ public class TestDefaultedMap extends AbstractTestIterableMap { @SuppressWarnings("unchecked") public void testMapGet2() { HashMap base = new HashMap(); - Map map = DefaultedMap.decorate(base, (V) "NULL"); + Map map = DefaultedMap.defaultedMap(base, (V) "NULL"); assertEquals(0, map.size()); assertEquals(0, base.size()); @@ -88,7 +88,7 @@ public class TestDefaultedMap extends AbstractTestIterableMap { @SuppressWarnings("unchecked") public void testMapGet3() { HashMap base = new HashMap(); - Map map = DefaultedMap.decorate(base, ConstantFactory.getInstance((V) "NULL")); + Map map = DefaultedMap.defaultedMap(base, ConstantFactory.constantFactory((V) "NULL")); assertEquals(0, map.size()); assertEquals(0, base.size()); @@ -107,7 +107,7 @@ public class TestDefaultedMap extends AbstractTestIterableMap { @SuppressWarnings("unchecked") public void testMapGet4() { HashMap base = new HashMap(); - Map map = DefaultedMap.decorate(base, new Transformer() { + Map map = DefaultedMap.defaultedMap(base, new Transformer() { public V transform(K input) { if (input instanceof String) { return (V) "NULL"; diff --git a/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java b/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java index 8479d4b8a..041a7aed5 100644 --- a/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java +++ b/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java @@ -38,14 +38,14 @@ public class TestFixedSizeMap extends AbstractTestIterableMap { @Override public IterableMap makeObject() { - return FixedSizeMap.decorate(new HashMap()); + return FixedSizeMap.fixedSizeMap(new HashMap()); } @Override public IterableMap makeFullMap() { Map map = new HashMap(); addSampleMappings(map); - return FixedSizeMap.decorate(map); + return FixedSizeMap.fixedSizeMap(map); } @Override diff --git a/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java b/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java index 2f25fe422..882478071 100644 --- a/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java +++ b/src/test/org/apache/commons/collections/map/TestFixedSizeSortedMap.java @@ -45,14 +45,14 @@ public class TestFixedSizeSortedMap extends AbstractTestSortedMap { //----------------------------------------------------------------------- @Override public SortedMap makeObject() { - return FixedSizeSortedMap.decorate(new TreeMap()); + return FixedSizeSortedMap.fixedSizeSortedMap(new TreeMap()); } @Override public SortedMap makeFullMap() { SortedMap map = new TreeMap(); addSampleMappings(map); - return FixedSizeSortedMap.decorate(map); + return FixedSizeSortedMap.fixedSizeSortedMap(map); } @Override diff --git a/src/test/org/apache/commons/collections/map/TestLazyMap.java b/src/test/org/apache/commons/collections/map/TestLazyMap.java index b3070abd4..3c9a88ba7 100644 --- a/src/test/org/apache/commons/collections/map/TestLazyMap.java +++ b/src/test/org/apache/commons/collections/map/TestLazyMap.java @@ -16,7 +16,7 @@ */ package org.apache.commons.collections.map; -import static org.apache.commons.collections.map.LazyMap.getLazyMap; +import static org.apache.commons.collections.map.LazyMap.lazyMap; import java.util.HashMap; import java.util.Map; @@ -46,7 +46,7 @@ public class TestLazyMap extends AbstractTestIterableMap { @Override public LazyMap makeObject() { - return getLazyMap(new HashMap(), FactoryUtils.nullFactory()); + return lazyMap(new HashMap(), FactoryUtils.nullFactory()); } //----------------------------------------------------------------------- @@ -57,7 +57,7 @@ public class TestLazyMap extends AbstractTestIterableMap { @Test public void mapGetWithFactory() { - Map map = getLazyMap(new HashMap(), oneFactory); + Map map = lazyMap(new HashMap(), oneFactory); assertEquals(0, map.size()); Number i1 = map.get("Five"); assertEquals(1, i1); @@ -67,7 +67,7 @@ public class TestLazyMap extends AbstractTestIterableMap { assertEquals(1, map.size()); assertSame(i1, i2); - map = getLazyMap(new HashMap(), FactoryUtils.nullFactory()); + map = lazyMap(new HashMap(), FactoryUtils.nullFactory()); Object o = map.get("Five"); assertEquals(null,o); assertEquals(1, map.size()); @@ -80,7 +80,7 @@ public class TestLazyMap extends AbstractTestIterableMap { return input.intValue(); } }; - Map map = getLazyMap(new HashMap(), intConverter ); + Map map = lazyMap(new HashMap(), intConverter ); assertEquals(0, map.size()); Number i1 = map.get(123L); assertEquals(123, i1); diff --git a/src/test/org/apache/commons/collections/map/TestLazySortedMap.java b/src/test/org/apache/commons/collections/map/TestLazySortedMap.java index b837c2e2f..fb7925364 100644 --- a/src/test/org/apache/commons/collections/map/TestLazySortedMap.java +++ b/src/test/org/apache/commons/collections/map/TestLazySortedMap.java @@ -16,7 +16,7 @@ */ package org.apache.commons.collections.map; -import static org.apache.commons.collections.map.LazySortedMap.getLazySortedMap; +import static org.apache.commons.collections.map.LazySortedMap.lazySortedMap; import java.util.Comparator; import java.util.Map; @@ -49,7 +49,7 @@ public class TestLazySortedMap extends AbstractTestSortedMap { @Override public SortedMap makeObject() { - return getLazySortedMap(new TreeMap(), FactoryUtils.nullFactory()); + return lazySortedMap(new TreeMap(), FactoryUtils.nullFactory()); } @Override @@ -72,13 +72,13 @@ public class TestLazySortedMap extends AbstractTestSortedMap { @Test public void mapGet() { - Map map = getLazySortedMap(new TreeMap(), oneFactory); + Map map = lazySortedMap(new TreeMap(), oneFactory); assertEquals(0, map.size()); Number i1 = map.get(5); assertEquals(1, i1); assertEquals(1, map.size()); - map = getLazySortedMap(new TreeMap(), FactoryUtils.nullFactory()); + map = lazySortedMap(new TreeMap(), FactoryUtils.nullFactory()); Number o = map.get(5); assertEquals(null,o); assertEquals(1, map.size()); @@ -87,7 +87,7 @@ public class TestLazySortedMap extends AbstractTestSortedMap { //----------------------------------------------------------------------- public void testSortOrder() { - SortedMap map = getLazySortedMap(new TreeMap(), oneFactory); + SortedMap map = lazySortedMap(new TreeMap(), oneFactory); map.put("A", 5); map.get("B"); // Entry with value "One" created map.put("C", 8); @@ -107,16 +107,16 @@ public class TestLazySortedMap extends AbstractTestSortedMap { public void testTransformerDecorate() { Transformer transformer = TransformerUtils.asTransformer(oneFactory); - SortedMap map = getLazySortedMap(new TreeMap(), transformer); + SortedMap map = lazySortedMap(new TreeMap(), transformer); assertTrue(map instanceof LazySortedMap); try { - map = getLazySortedMap(new TreeMap(), (Transformer) null); + map = lazySortedMap(new TreeMap(), (Transformer) null); fail("Expecting IllegalArgumentException for null transformer"); } catch (IllegalArgumentException e) { // expected } try { - map = getLazySortedMap((SortedMap) null, transformer); + map = lazySortedMap((SortedMap) null, transformer); fail("Expecting IllegalArgumentException for null map"); } catch (IllegalArgumentException e) { // expected diff --git a/src/test/org/apache/commons/collections/map/TestListOrderedMap.java b/src/test/org/apache/commons/collections/map/TestListOrderedMap.java index f123c1014..7d2b1f358 100644 --- a/src/test/org/apache/commons/collections/map/TestListOrderedMap.java +++ b/src/test/org/apache/commons/collections/map/TestListOrderedMap.java @@ -49,7 +49,7 @@ public class TestListOrderedMap extends AbstractTestOrderedMap { @Override public ListOrderedMap makeObject() { - return (ListOrderedMap) ListOrderedMap.decorate(new HashMap()); + return (ListOrderedMap) ListOrderedMap.listOrderedMap(new HashMap()); } /** diff --git a/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java b/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java index ca3f35fea..dff69ac54 100644 --- a/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java +++ b/src/test/org/apache/commons/collections/map/TestMultiKeyMap.java @@ -419,7 +419,7 @@ public class TestMultiKeyMap extends AbstractTestIterableMap map = MultiKeyMap.decorate(new LRUMap, V>(2)); + MultiKeyMap map = MultiKeyMap.multiKeyMap(new LRUMap, V>(2)); map.put((K) I1, (K) I2, (V) "1-2"); map.put((K) I1, (K) I3, (V) "1-1"); assertEquals(2, map.size()); diff --git a/src/test/org/apache/commons/collections/map/TestMultiValueMap.java b/src/test/org/apache/commons/collections/map/TestMultiValueMap.java index 7efc3dd42..52e667a7b 100644 --- a/src/test/org/apache/commons/collections/map/TestMultiValueMap.java +++ b/src/test/org/apache/commons/collections/map/TestMultiValueMap.java @@ -109,7 +109,7 @@ public class TestMultiValueMap extends AbstractTestObject { @SuppressWarnings("unchecked") private > MultiValueMap createTestMap(Class collectionClass) { - final MultiValueMap map = MultiValueMap.decorate(new HashMap(), collectionClass); + final MultiValueMap map = MultiValueMap.multiValueMap(new HashMap(), collectionClass); map.put((K) "one", (V) "uno"); map.put((K) "one", (V) "un"); map.put((K) "two", (V) "dos"); @@ -254,7 +254,7 @@ public class TestMultiValueMap extends AbstractTestObject { @SuppressWarnings("unchecked") public void testPutWithList() { - MultiValueMap test = MultiValueMap.decorate(new HashMap(), ArrayList.class); + MultiValueMap test = MultiValueMap.multiValueMap(new HashMap(), ArrayList.class); assertEquals("a", test.put((K) "A", "a")); assertEquals("b", test.put((K) "A", "b")); assertEquals(1, test.size()); @@ -264,7 +264,7 @@ public class TestMultiValueMap extends AbstractTestObject { @SuppressWarnings("unchecked") public void testPutWithSet() { - MultiValueMap test = MultiValueMap.decorate(new HashMap(), HashSet.class); + MultiValueMap test = MultiValueMap.multiValueMap(new HashMap(), HashSet.class); assertEquals("a", test.put((K) "A", "a")); assertEquals("b", test.put((K) "A", "b")); assertEquals(null, test.put((K) "A", "a")); diff --git a/src/test/org/apache/commons/collections/map/TestPredicatedMap.java b/src/test/org/apache/commons/collections/map/TestPredicatedMap.java index 6026d0588..8e6725fb0 100644 --- a/src/test/org/apache/commons/collections/map/TestPredicatedMap.java +++ b/src/test/org/apache/commons/collections/map/TestPredicatedMap.java @@ -50,7 +50,7 @@ public class TestPredicatedMap extends AbstractTestIterableMap { //----------------------------------------------------------------------- protected IterableMap decorateMap(Map map, Predicate keyPredicate, Predicate valuePredicate) { - return PredicatedMap.decorate(map, keyPredicate, valuePredicate); + return PredicatedMap.predicatedMap(map, keyPredicate, valuePredicate); } @Override diff --git a/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.java b/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.java index 584fd0f4c..e022a9eac 100644 --- a/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.java +++ b/src/test/org/apache/commons/collections/map/TestPredicatedSortedMap.java @@ -52,7 +52,7 @@ public class TestPredicatedSortedMap extends AbstractTestSortedMap { //----------------------------------------------------------------------- protected SortedMap decorateMap(SortedMap map, Predicate keyPredicate, Predicate valuePredicate) { - return PredicatedSortedMap.decorate(map, keyPredicate, valuePredicate); + return PredicatedSortedMap.predicatedSortedMap(map, keyPredicate, valuePredicate); } @Override diff --git a/src/test/org/apache/commons/collections/map/TestSingletonMap.java b/src/test/org/apache/commons/collections/map/TestSingletonMap.java index 5f7683cca..1b8d7a706 100644 --- a/src/test/org/apache/commons/collections/map/TestSingletonMap.java +++ b/src/test/org/apache/commons/collections/map/TestSingletonMap.java @@ -50,7 +50,7 @@ public class TestSingletonMap extends AbstractTestOrderedMap { public OrderedMap makeObject() { // need an empty singleton map, but thats not possible // use a ridiculous fake instead to make the tests pass - return UnmodifiableOrderedMap.decorate(ListOrderedMap.decorate(new HashMap())); + return UnmodifiableOrderedMap.unmodifiableOrderedMap(ListOrderedMap.listOrderedMap(new HashMap())); } @Override diff --git a/src/test/org/apache/commons/collections/map/TestTransformedMap.java b/src/test/org/apache/commons/collections/map/TestTransformedMap.java index f1acb563c..04413b586 100644 --- a/src/test/org/apache/commons/collections/map/TestTransformedMap.java +++ b/src/test/org/apache/commons/collections/map/TestTransformedMap.java @@ -43,7 +43,7 @@ public class TestTransformedMap extends AbstractTestIterableMap { //----------------------------------------------------------------------- @Override public IterableMap makeObject() { - return TransformedMap.decorate(new HashMap(), TransformerUtils. nopTransformer(), + return TransformedMap.transformingMap(new HashMap(), TransformerUtils. nopTransformer(), TransformerUtils. nopTransformer()); } @@ -53,7 +53,7 @@ public class TestTransformedMap extends AbstractTestIterableMap { Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" }; Map map = TransformedMap - .decorate( + .transformingMap( new HashMap(), (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER, null); @@ -70,7 +70,7 @@ public class TestTransformedMap extends AbstractTestIterableMap { assertEquals(null, map.remove(els[0])); assertEquals(els[0], map.remove(new Integer((String) els[0]))); - map = TransformedMap.decorate(new HashMap(), null, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + map = TransformedMap.transformingMap(new HashMap(), null, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, map.size()); for (int i = 0; i < els.length; i++) { map.put((K) els[i], (V) els[i]); @@ -104,7 +104,7 @@ public class TestTransformedMap extends AbstractTestIterableMap { base.put((K) "C", (V) "3"); Map trans = TransformedMap - .decorate( + .transformingMap( base, null, (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); @@ -124,7 +124,7 @@ public class TestTransformedMap extends AbstractTestIterableMap { base.put((K) "C", (V) "3"); Map trans = TransformedMap - .decorateTransform( + .transformedMap( base, null, (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); diff --git a/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java b/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java index 9ec5a44f5..3ba281fc5 100644 --- a/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java +++ b/src/test/org/apache/commons/collections/map/TestTransformedSortedMap.java @@ -51,7 +51,7 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap @Override @SuppressWarnings("unchecked") public SortedMap makeObject() { - return TransformedSortedMap.decorate(new TreeMap(), + return TransformedSortedMap.transformingSortedMap(new TreeMap(), (Transformer) TransformerUtils.nopTransformer(), (Transformer) TransformerUtils.nopTransformer()); } @@ -68,7 +68,7 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" }; SortedMap map = TransformedSortedMap - .decorate( + .transformingSortedMap( new TreeMap(), (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER, null); @@ -92,7 +92,7 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap assertEquals(els[0], map.remove(new Integer((String) els[0]))); map = TransformedSortedMap - .decorate( + .transformingSortedMap( new TreeMap(), null, (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); @@ -129,7 +129,7 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap base.put((K) "C", (V) "3"); SortedMap trans = TransformedSortedMap - .decorate( + .transformingSortedMap( base, null, (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); @@ -149,7 +149,7 @@ public class TestTransformedSortedMap extends AbstractTestSortedMap base.put((K) "C", (V) "3"); SortedMap trans = TransformedSortedMap - .decorateTransform( + .transformedSortedMap( base, null, (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); diff --git a/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java b/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java index 9d2447412..ef12520e8 100644 --- a/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java +++ b/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java @@ -41,7 +41,7 @@ public class TestUnmodifiableMap extends AbstractTestIterableMap { @Override public IterableMap makeObject() { - return (IterableMap) UnmodifiableMap.decorate(new HashMap()); + return (IterableMap) UnmodifiableMap.unmodifiableMap(new HashMap()); } @Override @@ -63,7 +63,7 @@ public class TestUnmodifiableMap extends AbstractTestIterableMap { public IterableMap makeFullMap() { Map m = new HashMap(); addSampleMappings(m); - return (IterableMap) UnmodifiableMap.decorate(m); + return (IterableMap) UnmodifiableMap.unmodifiableMap(m); } //----------------------------------------------------------------------- @@ -74,10 +74,10 @@ public class TestUnmodifiableMap extends AbstractTestIterableMap { public void testDecorateFactory() { Map map = makeFullMap(); - assertSame(map, UnmodifiableMap.decorate(map)); + assertSame(map, UnmodifiableMap.unmodifiableMap(map)); try { - UnmodifiableMap.decorate(null); + UnmodifiableMap.unmodifiableMap(null); fail(); } catch (IllegalArgumentException ex) {} } diff --git a/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.java b/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.java index 8992136ce..05d096a6e 100644 --- a/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.java +++ b/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.java @@ -40,7 +40,7 @@ public class TestUnmodifiableOrderedMap extends AbstractTestOrderedMap makeObject() { - return UnmodifiableOrderedMap.decorate(ListOrderedMap.decorate(new HashMap())); + return UnmodifiableOrderedMap.unmodifiableOrderedMap(ListOrderedMap.listOrderedMap(new HashMap())); } @Override @@ -60,9 +60,9 @@ public class TestUnmodifiableOrderedMap extends AbstractTestOrderedMap makeFullMap() { - OrderedMap m = ListOrderedMap.decorate(new HashMap()); + OrderedMap m = ListOrderedMap.listOrderedMap(new HashMap()); addSampleMappings(m); - return UnmodifiableOrderedMap.decorate(m); + return UnmodifiableOrderedMap.unmodifiableOrderedMap(m); } //----------------------------------------------------------------------- @@ -73,10 +73,10 @@ public class TestUnmodifiableOrderedMap extends AbstractTestOrderedMap map = makeFullMap(); - assertSame(map, UnmodifiableOrderedMap.decorate(map)); + assertSame(map, UnmodifiableOrderedMap.unmodifiableOrderedMap(map)); try { - UnmodifiableOrderedMap.decorate(null); + UnmodifiableOrderedMap.unmodifiableOrderedMap(null); fail(); } catch (IllegalArgumentException ex) {} } diff --git a/src/test/org/apache/commons/collections/map/TestUnmodifiableSortedMap.java b/src/test/org/apache/commons/collections/map/TestUnmodifiableSortedMap.java index cca5236c8..b242f643f 100644 --- a/src/test/org/apache/commons/collections/map/TestUnmodifiableSortedMap.java +++ b/src/test/org/apache/commons/collections/map/TestUnmodifiableSortedMap.java @@ -40,7 +40,7 @@ public class TestUnmodifiableSortedMap extends AbstractTestSortedMap @Override public SortedMap makeObject() { - return UnmodifiableSortedMap.decorate(new TreeMap()); + return UnmodifiableSortedMap.unmodifiableSortedMap(new TreeMap()); } @Override @@ -62,7 +62,7 @@ public class TestUnmodifiableSortedMap extends AbstractTestSortedMap public SortedMap makeFullMap() { SortedMap m = new TreeMap(); addSampleMappings(m); - return UnmodifiableSortedMap.decorate(m); + return UnmodifiableSortedMap.unmodifiableSortedMap(m); } //----------------------------------------------------------------------- @@ -73,10 +73,10 @@ public class TestUnmodifiableSortedMap extends AbstractTestSortedMap public void testDecorateFactory() { SortedMap map = makeFullMap(); - assertSame(map, UnmodifiableSortedMap.decorate(map)); + assertSame(map, UnmodifiableSortedMap.unmodifiableSortedMap(map)); try { - UnmodifiableSortedMap.decorate(null); + UnmodifiableSortedMap.unmodifiableSortedMap(null); fail(); } catch (IllegalArgumentException ex) {} } diff --git a/src/test/org/apache/commons/collections/set/TestListOrderedSet.java b/src/test/org/apache/commons/collections/set/TestListOrderedSet.java index 6296785b6..9bf976a77 100644 --- a/src/test/org/apache/commons/collections/set/TestListOrderedSet.java +++ b/src/test/org/apache/commons/collections/set/TestListOrderedSet.java @@ -45,7 +45,7 @@ public class TestListOrderedSet extends AbstractTestSet { @Override public ListOrderedSet makeObject() { - return ListOrderedSet.decorate(new HashSet()); + return ListOrderedSet.listOrderedSet(new HashSet()); } @SuppressWarnings("unchecked") @@ -198,23 +198,23 @@ public class TestListOrderedSet extends AbstractTestSet { public void testDecorator() { try { - ListOrderedSet.decorate((List) null); + ListOrderedSet.listOrderedSet((List) null); fail(); } catch (IllegalArgumentException ex) {} try { - ListOrderedSet.decorate((Set) null); + ListOrderedSet.listOrderedSet((Set) null); fail(); } catch (IllegalArgumentException ex) {} try { - ListOrderedSet.decorate(null, null); + ListOrderedSet.listOrderedSet(null, null); fail(); } catch (IllegalArgumentException ex) {} try { - ListOrderedSet.decorate(new HashSet(), null); + ListOrderedSet.listOrderedSet(new HashSet(), null); fail(); } catch (IllegalArgumentException ex) {} try { - ListOrderedSet.decorate(null, new ArrayList()); + ListOrderedSet.listOrderedSet(null, new ArrayList()); fail(); } catch (IllegalArgumentException ex) {} } diff --git a/src/test/org/apache/commons/collections/set/TestMapBackedSet.java b/src/test/org/apache/commons/collections/set/TestMapBackedSet.java index cbf683c51..abc903caa 100644 --- a/src/test/org/apache/commons/collections/set/TestMapBackedSet.java +++ b/src/test/org/apache/commons/collections/set/TestMapBackedSet.java @@ -36,7 +36,7 @@ public class TestMapBackedSet extends AbstractTestSet { @Override public Set makeObject() { - return MapBackedSet.decorate(new HashedMap()); + return MapBackedSet.mapBackedSet(new HashedMap()); } @Override diff --git a/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java b/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java index c305ceb20..2d13e2eff 100644 --- a/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java +++ b/src/test/org/apache/commons/collections/set/TestMapBackedSet2.java @@ -37,7 +37,7 @@ public class TestMapBackedSet2 extends AbstractTestSet { @Override public Set makeObject() { - return MapBackedSet.decorate(new LinkedMap()); + return MapBackedSet.mapBackedSet(new LinkedMap()); } @SuppressWarnings("unchecked") diff --git a/src/test/org/apache/commons/collections/set/TestPredicatedSet.java b/src/test/org/apache/commons/collections/set/TestPredicatedSet.java index 77d9eced7..b918c8615 100644 --- a/src/test/org/apache/commons/collections/set/TestPredicatedSet.java +++ b/src/test/org/apache/commons/collections/set/TestPredicatedSet.java @@ -42,7 +42,7 @@ public class TestPredicatedSet extends AbstractTestSet { protected Predicate truePredicate = TruePredicate.truePredicate(); protected PredicatedSet decorateSet(Set set, Predicate predicate) { - return (PredicatedSet) PredicatedSet.decorate(set, predicate); + return (PredicatedSet) PredicatedSet.predicatedSet(set, predicate); } @Override diff --git a/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java b/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java index 042eb3c62..e759e4c8e 100644 --- a/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java +++ b/src/test/org/apache/commons/collections/set/TestPredicatedSortedSet.java @@ -53,14 +53,14 @@ public class TestPredicatedSortedSet extends AbstractTestSortedSet { @Override public SortedSet makeObject() { - return PredicatedSortedSet.decorate(new TreeSet(), truePredicate); + return PredicatedSortedSet.predicatedSortedSet(new TreeSet(), truePredicate); } @Override public SortedSet makeFullCollection() { TreeSet set = new TreeSet(); set.addAll(Arrays.asList(getFullElements())); - return PredicatedSortedSet.decorate(set, truePredicate); + return PredicatedSortedSet.predicatedSortedSet(set, truePredicate); } //-------------------------------------------------------------------- @@ -72,7 +72,7 @@ public class TestPredicatedSortedSet extends AbstractTestSortedSet { }; protected PredicatedSortedSet makeTestSet() { - return (PredicatedSortedSet) PredicatedSortedSet.decorate(new TreeSet(), testPredicate); + return (PredicatedSortedSet) PredicatedSortedSet.predicatedSortedSet(new TreeSet(), testPredicate); } public void testGetSet() { diff --git a/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java b/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java index 561e67b79..4f2e07eb9 100644 --- a/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java +++ b/src/test/org/apache/commons/collections/set/TestSynchronizedSet.java @@ -45,7 +45,7 @@ public class TestSynchronizedSet extends AbstractTestSet { //------------------------------------------------------------------- @Override public Set makeObject() { - return SynchronizedSet.decorate(new HashSet()); + return SynchronizedSet.synchronizedSet(new HashSet()); } @Override diff --git a/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java b/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java index 111142fe2..de759991f 100644 --- a/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java +++ b/src/test/org/apache/commons/collections/set/TestSynchronizedSortedSet.java @@ -45,7 +45,7 @@ public class TestSynchronizedSortedSet extends AbstractTestSortedSet { //------------------------------------------------------------------- @Override public SortedSet makeObject() { - return SynchronizedSortedSet.decorate(new TreeSet()); + return SynchronizedSortedSet.synchronizedSortedSet(new TreeSet()); } @Override diff --git a/src/test/org/apache/commons/collections/set/TestTransformedSet.java b/src/test/org/apache/commons/collections/set/TestTransformedSet.java index e35e52725..df35374c2 100644 --- a/src/test/org/apache/commons/collections/set/TestTransformedSet.java +++ b/src/test/org/apache/commons/collections/set/TestTransformedSet.java @@ -53,7 +53,7 @@ public class TestTransformedSet extends AbstractTestSet { @Override @SuppressWarnings("unchecked") public Set makeObject() { - return TransformedSet.decorate(new HashSet(), + return TransformedSet.transformingSet(new HashSet(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); } @@ -62,13 +62,13 @@ public class TestTransformedSet extends AbstractTestSet { public Set makeFullCollection() { Set list = new HashSet(); list.addAll(Arrays.asList(getFullElements())); - return TransformedSet.decorate(list, + return TransformedSet.transformingSet(list, (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); } @SuppressWarnings("unchecked") public void testTransformedSet() { - Set set = TransformedSet.decorate(new HashSet(), + Set set = TransformedSet.transformingSet(new HashSet(), (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, set.size()); E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" }; @@ -90,7 +90,7 @@ public class TestTransformedSet extends AbstractTestSet { for (int i = 0; i < els.length; i++) { originalSet.add(els[i]); } - Set set = TransformedSet.decorateTransform(originalSet, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Set set = TransformedSet.transformedSet(originalSet, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, set.size()); for (int i = 0; i < els.length; i++) { assertEquals(true, set.contains(new Integer((String) els[i]))); diff --git a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java index 0b52dc489..68c9316ae 100644 --- a/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java +++ b/src/test/org/apache/commons/collections/set/TestTransformedSortedSet.java @@ -50,7 +50,7 @@ public class TestTransformedSortedSet extends AbstractTestSortedSet { @Override @SuppressWarnings("unchecked") public SortedSet makeObject() { - return TransformedSortedSet.decorate(new TreeSet(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); + return TransformedSortedSet.transformingSortedSet(new TreeSet(), (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); } @Override @@ -58,13 +58,13 @@ public class TestTransformedSortedSet extends AbstractTestSortedSet { public SortedSet makeFullCollection() { SortedSet set = new TreeSet(); set.addAll(Arrays.asList(getFullElements())); - return TransformedSortedSet.decorate(set, (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); + return TransformedSortedSet.transformingSortedSet(set, (Transformer) TestTransformedCollection.NOOP_TRANSFORMER); } //----------------------------------------------------------------------- @SuppressWarnings("unchecked") public void testTransformedSet() { - SortedSet set = TransformedSortedSet.decorate(new TreeSet(), + SortedSet set = TransformedSortedSet.transformingSortedSet(new TreeSet(), (Transformer) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, set.size()); E[] els = (E[]) new Object[] { "1", "3", "5", "7", "2", "4", "6" }; @@ -83,7 +83,7 @@ public class TestTransformedSortedSet extends AbstractTestSortedSet { for (int i = 0; i < els.length; i++) { originalSet.add(els[i]); } - Set set = TransformedSortedSet.decorateTransform(originalSet, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); + Set set = TransformedSortedSet.transformedSet(originalSet, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(els.length, set.size()); for (int i = 0; i < els.length; i++) { assertEquals(true, set.contains(new Integer((String) els[i]))); diff --git a/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java b/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java index 67afdd702..f70721491 100644 --- a/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java +++ b/src/test/org/apache/commons/collections/set/TestUnmodifiableSet.java @@ -46,14 +46,14 @@ public class TestUnmodifiableSet extends AbstractTestSet { //------------------------------------------------------------------- @Override public Set makeObject() { - return UnmodifiableSet.decorate(new HashSet()); + return UnmodifiableSet.unmodifiableSet(new HashSet()); } @Override public Set makeFullCollection() { HashSet set = new HashSet(); set.addAll(Arrays.asList(getFullElements())); - return UnmodifiableSet.decorate(set); + return UnmodifiableSet.unmodifiableSet(set); } @Override diff --git a/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java b/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java index 4d6a417b1..4a0cf14cc 100644 --- a/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java +++ b/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java @@ -51,14 +51,14 @@ public class TestUnmodifiableSortedSet extends AbstractTestSortedSet { //------------------------------------------------------------------- @Override public SortedSet makeObject() { - return UnmodifiableSortedSet.decorate(new TreeSet()); + return UnmodifiableSortedSet.unmodifiableSortedSet(new TreeSet()); } @Override public UnmodifiableSortedSet makeFullCollection() { TreeSet set = new TreeSet(); set.addAll(Arrays.asList(getFullElements())); - return (UnmodifiableSortedSet) UnmodifiableSortedSet.decorate(set); + return (UnmodifiableSortedSet) UnmodifiableSortedSet.unmodifiableSortedSet(set); } @Override diff --git a/src/test/org/apache/commons/collections/splitmap/TestSplitMapUtils.java b/src/test/org/apache/commons/collections/splitmap/TestSplitMapUtils.java index c531e69d3..0c33dd69b 100644 --- a/src/test/org/apache/commons/collections/splitmap/TestSplitMapUtils.java +++ b/src/test/org/apache/commons/collections/splitmap/TestSplitMapUtils.java @@ -57,7 +57,7 @@ public class TestSplitMapUtils extends BulkTest { protected void setUp() throws Exception { super.setUp(); backingMap = new HashMap(); - transformedMap = TransformedMap.decorate(backingMap, NOPTransformer. getInstance(), + transformedMap = TransformedMap.transformingMap(backingMap, NOPTransformer. nopTransformer(), stringToInt); for (int i = 0; i < 10; i++) { transformedMap.put(String.valueOf(i), String.valueOf(i)); diff --git a/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java b/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java index 1fe588566..890d85b43 100644 --- a/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java +++ b/src/test/org/apache/commons/collections/splitmap/TestTransformedMap.java @@ -62,7 +62,7 @@ public class TestTransformedMap extends BulkTest { // ----------------------------------------------------------------------- public void testTransformedMap() { - TransformedMap> map = TransformedMap.decorate( + TransformedMap> map = TransformedMap.transformingMap( new HashMap>(), intToString, objectToClass); Integer[] k = new Integer[] { 0, 1, 2, 3, 4, 5, 6 }; @@ -86,8 +86,8 @@ public class TestTransformedMap extends BulkTest { assertEquals(objectToClass.transform(v[0]), map.remove(intToString.transform(k[0]))); assertEquals(--sz, map.size()); - TransformedMap map2 = TransformedMap.decorate( - new HashMap(), NOPTransformer. getInstance(), stringToInt); + TransformedMap map2 = TransformedMap.transformingMap( + new HashMap(), NOPTransformer. nopTransformer(), stringToInt); assertEquals(0, map2.size()); for (int i = 0; i < 6; i++) { map2.put(String.valueOf(i), String.valueOf(i)); @@ -106,8 +106,8 @@ public class TestTransformedMap extends BulkTest { // ----------------------------------------------------------------------- public void testMapIterator() { - TransformedMap map = TransformedMap.decorate( - new HashMap(), NOPTransformer. getInstance(), stringToInt); + TransformedMap map = TransformedMap.transformingMap( + new HashMap(), NOPTransformer. nopTransformer(), stringToInt); assertEquals(0, map.size()); for (int i = 0; i < 6; i++) { map.put(String.valueOf(i), String.valueOf(i)); @@ -121,10 +121,10 @@ public class TestTransformedMap extends BulkTest { } public void testEmptyMap() throws IOException, ClassNotFoundException { - TransformedMap map = TransformedMap.decorate( + TransformedMap map = TransformedMap.transformingMap( new HashMap(), - NOPTransformer.getInstance(), - NOPTransformer.getInstance() ); + NOPTransformer.nopTransformer(), + NOPTransformer.nopTransformer() ); ObjectInputStream in = new ObjectInputStream( new FileInputStream( "data/test/TransformedMap.emptyCollection.version3.2.obj" ) ); Object readObject = in.readObject(); @@ -136,10 +136,10 @@ public class TestTransformedMap extends BulkTest { } public void testFullMap() throws IOException, ClassNotFoundException { - TransformedMap map = TransformedMap.decorate( + TransformedMap map = TransformedMap.transformingMap( new HashMap(), - NOPTransformer.getInstance(), - NOPTransformer.getInstance() ); + NOPTransformer.nopTransformer(), + NOPTransformer.nopTransformer() ); map.put( "a", "b" ); map.put( "c", "d" ); map.put( "e", "f" );