Submitted by: Stephen Colebourne
I made a few minor modifications (e.g. adding </li> tags), along with modifying
the requirement of static inner classes for the decorators to be more in line
with my perception of consensus from the discussion.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130737 13f79535-47bb-0310-9956-ffa450edef68
following changes to the Avalon implementation:
Changed improper short form of license to the approved long form.
Changed package from org.apache.avalon.excaliber.collections to
org.apache.commons.collections.
Altered to allow null keys and null values.
Fixed the values() method to return all values from the map. That is, when a
particular value is mapped to from two different keys, it should be included
twice in the values() collection; however the avalon implementation was using a
Set (thus not including duplicates). The new implementation uses a list which
does not restrict duplicate elements.
Fixed the put(Object,Object) method to return null rather than the value being
put into the map when the key does not already exist in the map (per the Map
contract).
Added equals(Object) and hashCode() implementations to conform to the Map
contract.
Altered the Node inner class's hashCode() method to return the hashCode of the
Map.Entry as defined in the Map.Entry's contract.
Added an equals(Object) method to the Node inner class to conform to the
Map.Entry contract.
Things left todo:
Alter the keySet(), values(), and entrySet() methods to return collections that
are backed by the map per the Map contract.
Add a constructor that takes another Map and adds all the mappings from that
map (per the Map recommendation).
Implement a DynamicBucketMap that will allow for dynamic resizing of the
hashtable's structure such that the map will not suffer a performance penalty
when the number of elements in the map exceeds the number of buckets in the
map.
Improve the documentation to indicate the performance problems when specifying
a size that is smaller than the expected number of elements.
Other general documentation cleanup
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130736 13f79535-47bb-0310-9956-ffa450edef68
so the full suite of List tests is performed on them.
Used BulkTest.makeSuite to pick up the sublist tests.
There should probably be additional work for testing the
primitive operations.
Submitted by: Paul Jack ( pjack at sfaf dot org )
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130735 13f79535-47bb-0310-9956-ffa450edef68
essentially making it an unmodifiable List. Since setFloat(int,float)
and removeFloatAt(int) already existed, I added trivial
implementations for set(int,Object) and remove(int).
Submitted by: Paul Jack ( pjack at sfaf dot org )
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130734 13f79535-47bb-0310-9956-ffa450edef68
TestCollection patterns. A bulk test has been included for
sublists and sub-sublists.
Removed the deprecated method from TestCollection, as no one uses
it anymore.
Modified TestCursorableLinkedList so that serialization tests on
sublists and sub-sublists are ignored.
Submitted by: Paul Jack ( pjack at sfaf dot org )
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130731 13f79535-47bb-0310-9956-ffa450edef68
raising a NullPointerException if null were passed as the argument.
This patch file fixes the behavior so that these methods will
correctly find a null element.
Submitted by: Paul Jack ( pjack at sfaf dot org )
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130730 13f79535-47bb-0310-9956-ffa450edef68
- TestBeanMap
- TestCursorableLinkedList
- TestDoubleOrderedMap
- TestFastHashMap
- TestFastHashMap1
- TestFastTreeMap
- TestFastTreeMap1
- TestLRUMap
- TestSequencedHashMap
- TestSoftRefHashMap
Submitted by Paul Jack ( pjack at sfaf dot org ).
Note: TestAll does not contain reference to TestSoftRefHashMap, so this test is
not automatically run. If you run it manually, you will see many failures that
are due to bug 9571.
Note: With this commit, there are four test failures if you are running with
JDK 1.2. This is due to a bug in the JDK's implementation of keySet on a
HashMap which incorrectly returns false after removing a mapping which maps a
key to a null value. Incidently, this problem is very similar to the problem
that existed on SequencedHashMap, filed as bug 9719, and fixed on June 9th.
See: http://developer.java.sun.com/developer/bugParade/bugs/4286765.html
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130727 13f79535-47bb-0310-9956-ffa450edef68
along with resetEmpty() and resetFull(). This allows for more calls to verify
to ensure that calls to methods that should not modify a collection don't
actually modify it.
Split the verify() method into four separate verification methods. This way,
if a Map implementation needs to change the way verification is performed for
just one of the collection views, they only need to override one method and
won't need to reimplement all the other verifications.
Override TestMultiHashMap's verifyValues() method to retrieve a fresh copy of
the values collection before verification. This ensures some verification
testing on the values, even though the values is not backed by the map (bug
9573)
Override a few more test methods and the verifyyMap and verifyEntrySet methods
for TestMultiHashMap since it's values are collections rather than the expected
objects. These will need to be filled in with better implementations to
actually test the MultiMap contact.
Removed the SupportsPut marker interface.
Removed some duplicate tests (i.e. some old tests that weren't written with the
current framework in mind and just duplicate the tests that have been added).
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130726 13f79535-47bb-0310-9956-ffa450edef68
Submitted by: Paul Jack ( pjack at sfaf dot org ).
Needed to change Paul's implementation slightly to get things compile properly
using JDK 1.2. The 1.2 compiler thought that the "confirmed" field was
ambiguous in the anonymous inner class and thus needed to be qualified with a
ClassName.this. In order to do that, the anonymous inner classes needed to be
made named inner classes.
This change exposes one test failure for MultiHashMap that appears to be caused
by its values() method not being backed by the map (bug 9573).
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130725 13f79535-47bb-0310-9956-ffa450edef68
should use makeEmptySet and makeFullSet rather than their collection
counterparts.
Added getSet() and getConfirmedSet() methods which wrap the collection and
confirmed fixtures so that tests don't need to perform the cast to a Set.
Modified tests that used makeEmptySet and makeFullSet to use the fixture
getSet() along with resetEmpty() and resetFull(). This allows for more calls
to verify() to ensure that calls to methods that should not modify a
collection don't actually modify it.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130724 13f79535-47bb-0310-9956-ffa450edef68
complete Set contract. This will be used to test Set implementations and set
views of other collections (e.g. Map.entrySet() and Map.keySet()).
Submitted by: Paul Jack ( pjack at sfaf dot org ).
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130723 13f79535-47bb-0310-9956-ffa450edef68
Removed commented out tests for equals and hashCode (the collection contract
does not specify a specific contract on equals and hashCode), and added a
comment at the top of the class so that no one comes in later and re-adds the
test cases.
Removed dependence on HashBag. If HashBag has a bug, this may adversly affect
the tests that are using it. Reimplemented without using HashBag.
Modified tests that used makeFullCollection and makeCollection to use the
fixture field "collection" along with resetEmpty() and resetFull(). This
allowed for more calls to verify to ensure that calls to methods that should
not modify a collection don't actually modify it.
When removing using the iterator, an equivalent operation cannot really be
performed on the confirmed collection for verification. After some
investigation, changed the existing tests (tested for instances of Set, List
and Bag) to one that is a bit more generic: A new flag (that test subclasses
can override) which specifies whether the elements in the collection are
distinguishable from each other (and such that it might matter which element is
actually removed from the collection when the iterator's remove method is
called).
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130722 13f79535-47bb-0310-9956-ffa450edef68
will be used to test straight Collection implementations and for collection
views of other collections (e.g. Map.values()).
Submitted by: Paul Jack ( pjack at sfaf dot org ).
Changed TestBag to extend from TestObject instead of TestCollection since the
Bag contract conflicts with the Collection contract. This needs to be
addressed at some point.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130721 13f79535-47bb-0310-9956-ffa450edef68
testing collections, maps, etc., can be reused to test collections, maps,
etc. that are returned from other collections. For example, the Map interface
defines entrySet() which is supposed to return a valid Set. The framework
added here would allow the Set testing code to be used for testing Sets and the
set returned from Map's entrySet() method.
Submitted by: Paul Jack < pjack at sfaf dot org >
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130720 13f79535-47bb-0310-9956-ffa450edef68
This can help avoid folks having to use the o.a*.c*.collections.comparators package, providing nice simple static helper method instead along the same lines as java.util.Collections and CollectionUtils here.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130714 13f79535-47bb-0310-9956-ffa450edef68
when one didn't exist before. That is, if containsKey(foo) returns
false, then get(foo) will not change that.
Added serial version UID to maintain backwards compatibility. The auto
generated serialization UID differs from the released version because
of the addition of a new method.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130699 13f79535-47bb-0310-9956-ffa450edef68