Commit Graph

523 Commits

Author SHA1 Message Date
Michael Smith 10e245918f Renamed supportsAdd and supportsRemove to isAddSupported and isRemoveSupported.
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
2002-06-18 02:51:12 +00:00
Michael Smith b79307f302 Enhanced TestCollection to more completely test the Collection contract. This
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
2002-06-18 01:14:23 +00:00
Michael Smith aed28e1dd2 Added framework to modularize collections tests such the testing code used for
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
2002-06-18 01:04:03 +00:00
Michael Smith d74c53cd0d Add a toString() to aid in debugging.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130719 13f79535-47bb-0310-9956-ffa450edef68
2002-06-16 18:56:19 +00:00
Michael Smith c28176cb14 Fixed javadoc warnings, most of which only appear with javadoc 1.4. I
really don't understand why javadoc likes references to inner classes in
some cases, but in others, it requires it to be fully qualified.  This
fixes all the warnings reported though.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130718 13f79535-47bb-0310-9956-ffa450edef68
2002-06-16 03:39:40 +00:00
Michael Smith e9f2bdc6a5 Fix NullPointerException in CursorableLinkedList.remove(Object) and
CursorableLinkedList.contains(Object) methods when the argument is
null.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130717 13f79535-47bb-0310-9956-ffa450edef68
2002-06-15 03:52:24 +00:00
Michael Smith 5fe503ec59 Renamed nullFirst and nullLast to nullLow and nullHigh. "First" and
"Last" don't really mean mcuh in the context of comparing two items.
Especially if you consider the comparator being used for a maximum
heap.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130716 13f79535-47bb-0310-9956-ffa450edef68
2002-06-12 04:28:22 +00:00
Michael Smith 404ad88cdc Added @since tags for classes introduced in the 1.0 and 2.0
collection releases.  I did not add @since tags to classes
added since the 2.0 release, because I'm not certain whether
the next release will be 2.1 or 3.0 or whatever.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130715 13f79535-47bb-0310-9956-ffa450edef68
2002-06-12 03:59:17 +00:00
James Strachan b8766d82a6 applied Paul Jacks' patch for a number of helper methods for working with Comparators.
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
2002-06-11 16:22:06 +00:00
Michael Smith b8dc22933b Fix email address links.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130713 13f79535-47bb-0310-9956-ffa450edef68
2002-06-11 02:41:47 +00:00
Michael Smith 8fdad7215b Add some collections that were missing from the package
documentation.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130712 13f79535-47bb-0310-9956-ffa450edef68
2002-06-11 02:40:52 +00:00
Michael Smith c8e641739a Fixed typo.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130711 13f79535-47bb-0310-9956-ffa450edef68
2002-06-10 05:33:53 +00:00
Michael Smith e02e354300 Added a comparator that provides explicit control over comparisons with null.
This can be used to create SortedSets or other sorted collections where nulls
are sorted first or last.  The basis for this comparator was this discussion on
the commons mailing list:

http://www.mail-archive.com/commons-dev%40jakarta.apache.org/msg07762.html


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130710 13f79535-47bb-0310-9956-ffa450edef68
2002-06-09 19:23:53 +00:00
Michael Smith c1cdfa611c Fix for bug 9719.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130709 13f79535-47bb-0310-9956-ffa450edef68
2002-06-09 07:14:14 +00:00
James Strachan bde0d09c4c Added Jonathan Carlson's patch for a Comparator that uses a Transformer
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130708 13f79535-47bb-0310-9956-ffa450edef68
2002-06-08 06:42:00 +00:00
Rodney Waldhoff d7f1ac38d0 add FloatArrayList and test
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130707 13f79535-47bb-0310-9956-ffa450edef68
2002-06-04 16:50:09 +00:00
Rodney Waldhoff 61cf43c0e7 add primitive collections, and tests
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130706 13f79535-47bb-0310-9956-ffa450edef68
2002-06-04 16:01:28 +00:00
Arron Claude Bates 26fbf88577 fixed List growing issue.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130705 13f79535-47bb-0310-9956-ffa450edef68
2002-05-29 03:22:42 +00:00
Arron Claude Bates 2dd5130b2c initial commit.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130704 13f79535-47bb-0310-9956-ffa450edef68
2002-05-29 02:57:41 +00:00
Michael Smith 1e22afa5b0 Added new testing code submitted by Paul Jack < pjack at sfaf dot org >
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130703 13f79535-47bb-0310-9956-ffa450edef68
2002-05-28 06:51:03 +00:00
Michael Smith 5d8832a059 Implemented equals(Object) and hashCode() as per the Map interface.
Also, added a toString() method for simpler debugging.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130702 13f79535-47bb-0310-9956-ffa450edef68
2002-05-24 04:00:30 +00:00
Rodney Waldhoff e2af015a2f fix a bug in FilterListIterator and add a test for it
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130701 13f79535-47bb-0310-9956-ffa450edef68
2002-05-13 16:10:37 +00:00
Michael Smith 6b320e8afe Fixed to have SequencedHashMap throw a ConcurrentModificationException
from its iterators if the map is modified through something other than
the iterator.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130700 13f79535-47bb-0310-9956-ffa450edef68
2002-05-09 03:20:59 +00:00
Michael Smith 09e7a4b86e Fixed to ensure that get(Object) won't add a mapping to a null value
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
2002-05-09 03:10:46 +00:00
Morgan James Delagrange 33f0ab0d46 added test for concurrent modifications
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130698 13f79535-47bb-0310-9956-ffa450edef68
2002-05-08 18:11:36 +00:00
Morgan James Delagrange a62220afa5 added test for concurrent modifications
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130697 13f79535-47bb-0310-9956-ffa450edef68
2002-05-08 17:54:28 +00:00
Morgan James Delagrange b17194ecad had to temporarily override test that causes an infinite loop
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130696 13f79535-47bb-0310-9956-ffa450edef68
2002-05-08 17:34:17 +00:00
Morgan James Delagrange 86bd2c4931 test to make sure that gets promote keys to the Most Recently Used
position


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130695 13f79535-47bb-0310-9956-ffa450edef68
2002-05-08 16:07:05 +00:00
Rodney Waldhoff 2769f6c83a (c) 2001 - 2002
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130694 13f79535-47bb-0310-9956-ffa450edef68
2002-05-04 12:33:01 +00:00
James Strachan bccc0cbfa2 Added Stephen's new PredicateUtils submission. Looks good; just need some unit test cases ;-)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130693 13f79535-47bb-0310-9956-ffa450edef68
2002-05-02 06:17:19 +00:00
Morgan James Delagrange f3eef9b91d fixed strage javadoc wording per patch
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130692 13f79535-47bb-0310-9956-ffa450edef68
2002-04-16 21:15:13 +00:00
Morgan James Delagrange fc2701212d new tests
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130691 13f79535-47bb-0310-9956-ffa450edef68
2002-04-10 16:33:23 +00:00
Morgan James Delagrange 1f59eea6bc A FilterIterator that skips over Objects that have already been returned
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130690 13f79535-47bb-0310-9956-ffa450edef68
2002-04-09 16:43:29 +00:00
Morgan James Delagrange 6c21eb2aa1 ListIteratorWrapper allows Iterators to simulate ListIterator behaviour
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130689 13f79535-47bb-0310-9956-ffa450edef68
2002-04-09 16:40:58 +00:00
Morgan James Delagrange 134caec9ec fixed doco bug
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130688 13f79535-47bb-0310-9956-ffa450edef68
2002-04-09 16:33:40 +00:00
Morgan James Delagrange 38e0a5c241 fixed documentation error - IteratorChain is not currently Serializable
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130687 13f79535-47bb-0310-9956-ffa450edef68
2002-04-08 23:59:58 +00:00
Morgan James Delagrange baf631663d An IteratorChain is a sequence of Iterators called until all Iterators are
exhausted


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130686 13f79535-47bb-0310-9956-ffa450edef68
2002-04-08 23:39:01 +00:00
Morgan James Delagrange cf75b03503 wrong version number in manifest
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130685 13f79535-47bb-0310-9956-ffa450edef68
2002-04-08 16:07:47 +00:00
Morgan James Delagrange a414bb1014 added optional cvs.root property to sample properties
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130683 13f79535-47bb-0310-9956-ffa450edef68
2002-04-02 16:31:15 +00:00
Morgan James Delagrange bb443f34a4 changed build script to use local copy of LICENSE file
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130682 13f79535-47bb-0310-9956-ffa450edef68
2002-04-02 16:29:20 +00:00
Morgan James Delagrange f1319b6447 added local copy of LICENSE file, in order to make build script more portable
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130681 13f79535-47bb-0310-9956-ffa450edef68
2002-04-02 16:20:36 +00:00
Morgan James Delagrange fe753a3640 updated source distro task to work more like previous versions
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130680 13f79535-47bb-0310-9956-ffa450edef68
2002-03-28 15:45:03 +00:00
Morgan James Delagrange d7b8588498 added target for source distribution
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130679 13f79535-47bb-0310-9956-ffa450edef68
2002-03-28 06:50:15 +00:00
Morgan James Delagrange fea6e61ea1 added LICENSE to binary distribution jar
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130678 13f79535-47bb-0310-9956-ffa450edef68
2002-03-28 05:23:37 +00:00
Morgan James Delagrange 9b81356c39 added targets to build binary distributions
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130677 13f79535-47bb-0310-9956-ffa450edef68
2002-03-28 05:13:54 +00:00
Morgan James Delagrange 59a50d1b9b List constructors for ComparatorChain no longer perform defensive copies
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130676 13f79535-47bb-0310-9956-ffa450edef68
2002-03-25 21:20:53 +00:00
Michael Smith 80ea89fd05 Renamed AbstractBag to DefaultMapBag. The implementation is more of a
"default map based implementation" and differs in design from the
AbstractSet, AbstractMap classes which do not make assumptions about
how they might be implemented.  To be consistent with JDK AbstractX
collections, an AbstractBag class should just be providing default
implementations that could be used regardless of underlying storage
mechanism.  For example, the add(Object) method would call the abstract
add(Object,int) method passing the object and 1. Since this
implementation assumes a Map based storage for the Bag, it does not
follow the AbstractX pattern, and thus has been renamed.  There is
still room for future addition of an AbstractBag that does not assume
a storage data structure.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130675 13f79535-47bb-0310-9956-ffa450edef68
2002-03-25 05:50:57 +00:00
Michael Smith e25229d271 Updated javadoc
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130674 13f79535-47bb-0310-9956-ffa450edef68
2002-03-24 22:00:55 +00:00
Michael Smith 63cf00bf0e Made BeanMap.values() and BeanMap.keySet() unmodifiable. This brings it more
in line with the Map contract where any modifications will throw
UnsupportedOperationException rather than allow modifications that are not
reflected in the underlying map.  This also keeps values(), keySet() and
entrySet() consistent with each other.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130673 13f79535-47bb-0310-9956-ffa450edef68
2002-03-24 21:53:27 +00:00
Michael Smith 302cc6fd28 Rather than throw a NullPointerException during hasMoreElements or nextElement
when no array is passed to the constructor, treat a null to the constructor as
an empty array.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130672 13f79535-47bb-0310-9956-ffa450edef68
2002-03-24 21:50:24 +00:00