scolebourne 2003/09/09 14:36:53
Modified: collections/src/java/org/apache/commons/collections
CollectionUtils.java
Log:
Javadoc improvements
Revision Changes Path
1.40 +21 -6
jakarta-commons/collections/src/java/org/apache/commons/collections/CollectionUtils.java
Index: CollectionUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/CollectionUtils.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- CollectionUtils.java 9 Sep 2003 21:25:18 -0000 1.39
+++ CollectionUtils.java 9 Sep 2003 21:36:53 -0000 1.40
@@ -806,9 +806,8 @@
}
}
-
/**
- * Reverses the order of the given array
+ * Reverses the order of the given array.
*
* @param array the array to reverse
*/
@@ -843,14 +842,22 @@
* This method uses the [EMAIL PROTECTED] BoundedCollection} class to determine
the
* full status. If the collection does not implement this interface then
* false is returned.
+ * <p>
+ * The collection does not have to implement this interface directly.
+ * If the collection has been decorated using the decorators subpackage
+ * then these will be removed to access the BoundedCollection.
*
- * @return true if the Collection is full
+ * @param coll the collection to check
+ * @return true if the BoundedCollection is full
* @throws NullPointerException if the collection is null
*/
public static boolean isFull(Collection coll) {
if (coll == null) {
throw new NullPointerException("The collection must not be null");
}
+ if (coll instanceof BoundedCollection) {
+ return ((BoundedCollection) coll).isFull();
+ }
try {
BoundedCollection bcoll =
UnmodifiableBoundedCollection.decorateUsing(coll);
return bcoll.isFull();
@@ -866,13 +873,21 @@
* This method uses the [EMAIL PROTECTED] BoundedCollection} class to determine
the
* maximum size. If the collection does not implement this interface then
* -1 is returned.
+ * <p>
+ * The collection does not have to implement this interface directly.
+ * If the collection has been decorated using the decorators subpackage
+ * then these will be removed to access the BoundedCollection.
*
- * @return the maximum size of the Collection, -1 if no maximum size
+ * @param coll the collection to check
+ * @return the maximum size of the BoundedCollection, -1 if no maximum size
* @throws NullPointerException if the collection is null
*/
public static int maxSize(Collection coll) {
if (coll == null) {
throw new NullPointerException("The collection must not be null");
+ }
+ if (coll instanceof BoundedCollection) {
+ return ((BoundedCollection) coll).maxSize();
}
try {
BoundedCollection bcoll =
UnmodifiableBoundedCollection.decorateUsing(coll);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]