Skip to content

Commit 8831944

Browse files
committed
Javadoc
1 parent 8400019 commit 8831944

File tree

2 files changed

+158
-156
lines changed

2 files changed

+158
-156
lines changed

src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java

Lines changed: 105 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -261,45 +261,45 @@ private static void assertUnorderedArrayEquals(final Object[] a1, final Object[]
261261
}
262262

263263
/**
264-
* A collection instance that will be used for testing.
264+
* A collection instance that will be used for testing.
265265
*/
266266
private Collection<E> collection;
267267

268268
/**
269-
* Confirmed collection. This is an instance of a collection that is
270-
* confirmed to conform exactly to the java.util.Collection contract.
271-
* Modification operations are tested by performing a mod on your
272-
* collection, performing the exact same mod on an equivalent confirmed
273-
* collection, and then calling verify() to make sure your collection
274-
* still matches the confirmed collection.
269+
* Confirmed collection. This is an instance of a collection that is
270+
* confirmed to conform exactly to the java.util.Collection contract.
271+
* Modification operations are tested by performing a mod on your
272+
* collection, performing the exact same mod on an equivalent confirmed
273+
* collection, and then calling verify() to make sure your collection
274+
* still matches the confirmed collection.
275275
*/
276276
private Collection<E> confirmed;
277277

278278
/**
279-
* Specifies whether equal elements in the collection are, in fact,
280-
* distinguishable with information not readily available.
281-
* <p>
282-
* If a particular value is to be removed from the collection, then there is
283-
* one and only one value that can be removed, even if there are other
284-
* elements which are equal to it.
285-
* </p>
286-
* <p>
287-
* In most collection cases, elements are not distinguishable (equal is
288-
* equal), thus this method defaults to return false. In some cases,
289-
* however, they are. For example, the collection returned from the map's
290-
* values() collection view are backed by the map, so while there may be
291-
* two values that are equal, their associated keys are not. Since the
292-
* keys are distinguishable, the values are.
293-
* </p>
294-
* <p>
295-
* This flag is used to skip some verifications for iterator.remove()
296-
* where it is impossible to perform an equivalent modification on the
297-
* confirmed collection because it is not possible to determine which
298-
* value in the confirmed collection to actually remove. Tests that
299-
* override the default (i.e. where equal elements are distinguishable),
300-
* should provide additional tests on iterator.remove() to make sure the
301-
* proper elements are removed when remove() is called on the iterator.
302-
* </p>
279+
* Specifies whether equal elements in the collection are, in fact,
280+
* distinguishable with information not readily available.
281+
* <p>
282+
* If a particular value is to be removed from the collection, then there is
283+
* one and only one value that can be removed, even if there are other
284+
* elements which are equal to it.
285+
* </p>
286+
* <p>
287+
* In most collection cases, elements are not distinguishable (equal is
288+
* equal), thus this method defaults to return false. In some cases,
289+
* however, they are. For example, the collection returned from the map's
290+
* values() collection view are backed by the map, so while there may be
291+
* two values that are equal, their associated keys are not. Since the
292+
* keys are distinguishable, the values are.
293+
* </p>
294+
* <p>
295+
* This flag is used to skip some verifications for iterator.remove()
296+
* where it is impossible to perform an equivalent modification on the
297+
* confirmed collection because it is not possible to determine which
298+
* value in the confirmed collection to actually remove. Tests that
299+
* override the default (i.e. where equal elements are distinguishable),
300+
* should provide additional tests on iterator.remove() to make sure the
301+
* proper elements are removed when remove() is called on the iterator.
302+
* </p>
303303
*/
304304
public boolean areEqualElementsDistinguishable() {
305305
return false;
@@ -323,18 +323,18 @@ public Collection<E> getConfirmed() {
323323
}
324324

325325
/**
326-
* Returns an array of objects that are contained in a collection
327-
* produced by {@link #makeFullCollection()}.
328-
* <p>
329-
* Every element in the returned array <em>must</em> be an element in a full collection.
330-
* </p>
331-
* <p>
332-
* The default implementation returns a heterogeneous array of
333-
* objects with some duplicates. null is added if allowed.
334-
* Override if you require specific testing elements. Note that if you
335-
* override {@link #makeFullCollection()}, you <em>must</em> override
336-
* this method to reflect the contents of a full collection.
337-
* <p>
326+
* Returns an array of objects that are contained in a collection
327+
* produced by {@link #makeFullCollection()}.
328+
* <p>
329+
* Every element in the returned array <em>must</em> be an element in a full collection.
330+
* </p>
331+
* <p>
332+
* The default implementation returns a heterogeneous array of
333+
* objects with some duplicates. null is added if allowed.
334+
* Override if you require specific testing elements. Note that if you
335+
* override {@link #makeFullCollection()}, you <em>must</em> override
336+
* this method to reflect the contents of a full collection.
337+
* <p>
338338
*/
339339
@SuppressWarnings("unchecked")
340340
public E[] getFullElements() {
@@ -347,12 +347,12 @@ public E[] getFullElements() {
347347
}
348348

349349
/**
350-
* Returns a list of elements suitable for return by
351-
* {@link #getFullElements()}. The array returned by this method
352-
* does not include null, but does include a variety of objects
353-
* of different types. Override getFullElements to return
354-
* the results of this method if your collection does not support
355-
* the null element.
350+
* Returns a list of elements suitable for return by
351+
* {@link #getFullElements()}. The array returned by this method
352+
* does not include null, but does include a variety of objects
353+
* of different types. Override getFullElements to return
354+
* the results of this method if your collection does not support
355+
* the null element.
356356
*/
357357
@SuppressWarnings("unchecked")
358358
public E[] getFullNonNullElements() {
@@ -379,10 +379,10 @@ public E[] getFullNonNullElements() {
379379
}
380380

381381
/**
382-
* Returns a list of string elements suitable for return by
383-
* {@link #getFullElements()}. Override getFullElements to return
384-
* the results of this method if your collection does not support
385-
* heterogeneous elements or the null element.
382+
* Returns a list of string elements suitable for return by
383+
* {@link #getFullElements()}. Override getFullElements to return
384+
* the results of this method if your collection does not support
385+
* heterogeneous elements or the null element.
386386
*/
387387
public Object[] getFullNonNullStringElements() {
388388
return new Object[] {
@@ -404,22 +404,22 @@ protected int getIterationBehaviour() {
404404
}
405405

406406
/**
407-
* Returns an array of elements that are <em>not</em> contained in a
408-
* full collection. Every element in the returned array must
409-
* not exist in a collection returned by {@link #makeFullCollection()}.
410-
* The default implementation returns a heterogeneous array of elements
411-
* without null. Note that some of the tests add these elements
412-
* to an empty or full collection, so if your collection restricts
413-
* certain kinds of elements, you should override this method.
407+
* Returns an array of elements that are <em>not</em> contained in a
408+
* full collection. Every element in the returned array must
409+
* not exist in a collection returned by {@link #makeFullCollection()}.
410+
* The default implementation returns a heterogeneous array of elements
411+
* without null. Note that some of the tests add these elements
412+
* to an empty or full collection, so if your collection restricts
413+
* certain kinds of elements, you should override this method.
414414
*/
415415
public E[] getOtherElements() {
416416
return getOtherNonNullElements();
417417
}
418418

419419
/**
420-
* Returns the default list of objects returned by
421-
* {@link #getOtherElements()}. Includes many objects
422-
* of different types.
420+
* Returns the default list of objects returned by
421+
* {@link #getOtherElements()}. Includes many objects
422+
* of different types.
423423
*/
424424
@SuppressWarnings("unchecked")
425425
public E[] getOtherNonNullElements() {
@@ -437,10 +437,10 @@ public E[] getOtherNonNullElements() {
437437
}
438438

439439
/**
440-
* Returns a list of string elements suitable for return by
441-
* {@link #getOtherElements()}. Override getOtherElements to return
442-
* the results of this method if your collection does not support
443-
* heterogeneous elements or the null element.
440+
* Returns a list of string elements suitable for return by
441+
* {@link #getOtherElements()}. Override getOtherElements to return
442+
* the results of this method if your collection does not support
443+
* heterogeneous elements or the null element.
444444
*/
445445
public Object[] getOtherNonNullStringElements() {
446446
return new Object[] {
@@ -450,14 +450,14 @@ public Object[] getOtherNonNullStringElements() {
450450
}
451451

452452
/**
453-
* Returns true if the collections produced by
454-
* {@link #makeObject()} and {@link #makeFullCollection()}
455-
* support the {@code add} and {@code addAll}
456-
* operations.
457-
* <p>
458-
* Default implementation returns true. Override if your collection
459-
* class does not support add or addAll.
460-
* </p>
453+
* Returns true if the collections produced by
454+
* {@link #makeObject()} and {@link #makeFullCollection()}
455+
* support the {@code add} and {@code addAll}
456+
* operations.
457+
* <p>
458+
* Default implementation returns true. Override if your collection
459+
* class does not support add or addAll.
460+
* </p>
461461
*/
462462
public boolean isAddSupported() {
463463
return true;
@@ -489,44 +489,44 @@ public boolean isNullSupported() {
489489
}
490490

491491
/**
492-
* Returns true if the collections produced by
493-
* {@link #makeObject()} and {@link #makeFullCollection()}
494-
* support the {@code remove}, {@code removeAll},
495-
* {@code retainAll}, {@code clear} and
496-
* {@code iterator().remove()} methods.
497-
* Default implementation returns true. Override if your collection
498-
* class does not support removal operations.
492+
* Returns true if the collections produced by
493+
* {@link #makeObject()} and {@link #makeFullCollection()}
494+
* support the {@code remove}, {@code removeAll},
495+
* {@code retainAll}, {@code clear} and
496+
* {@code iterator().remove()} methods.
497+
* Default implementation returns true. Override if your collection
498+
* class does not support removal operations.
499499
*/
500500
public boolean isRemoveSupported() {
501501
return true;
502502
}
503503

504504
/**
505-
* Returns a confirmed empty collection.
506-
* For instance, an {@link java.util.ArrayList} for lists or a
507-
* {@link java.util.HashSet} for sets.
505+
* Returns a confirmed empty collection.
506+
* For instance, an {@link java.util.ArrayList} for lists or a
507+
* {@link java.util.HashSet} for sets.
508508
*
509-
* @return a confirmed empty collection
509+
* @return a confirmed empty collection
510510
*/
511511
public abstract Collection<E> makeConfirmedCollection();
512512

513513
/**
514-
* Returns a confirmed full collection.
515-
* For instance, an {@link java.util.ArrayList} for lists or a
516-
* {@link java.util.HashSet} for sets. The returned collection
517-
* should contain the elements returned by {@link #getFullElements()}.
514+
* Returns a confirmed full collection.
515+
* For instance, an {@link java.util.ArrayList} for lists or a
516+
* {@link java.util.HashSet} for sets. The returned collection
517+
* should contain the elements returned by {@link #getFullElements()}.
518518
*
519-
* @return a confirmed full collection
519+
* @return a confirmed full collection
520520
*/
521521
public abstract Collection<E> makeConfirmedFullCollection();
522522

523523
/**
524-
* Returns a full collection to be used for testing. The collection
525-
* returned by this method should contain every element returned by
526-
* {@link #getFullElements()}. The default implementation, in fact,
527-
* simply invokes {@code addAll} on an empty collection with
528-
* the results of {@link #getFullElements()}. Override this default
529-
* if your collection doesn't support addAll.
524+
* Returns a full collection to be used for testing. The collection
525+
* returned by this method should contain every element returned by
526+
* {@link #getFullElements()}. The default implementation, in fact,
527+
* simply invokes {@code addAll} on an empty collection with
528+
* the results of {@link #getFullElements()}. Override this default
529+
* if your collection doesn't support addAll.
530530
*/
531531
public Collection<E> makeFullCollection() {
532532
final Collection<E> c = makeObject();
@@ -541,19 +541,19 @@ public Collection<E> makeFullCollection() {
541541
public abstract Collection<E> makeObject();
542542

543543
/**
544-
* Resets the {@link #collection} and {@link #confirmed} fields to empty
545-
* collections. Invoke this method before performing a modification
546-
* test.
544+
* Resets the {@link #collection} and {@link #confirmed} fields to empty
545+
* collections. Invoke this method before performing a modification
546+
* test.
547547
*/
548548
public void resetEmpty() {
549549
this.setCollection(makeObject());
550550
this.setConfirmed(makeConfirmedCollection());
551551
}
552552

553553
/**
554-
* Resets the {@link #collection} and {@link #confirmed} fields to full
555-
* collections. Invoke this method before performing a modification
556-
* test.
554+
* Resets the {@link #collection} and {@link #confirmed} fields to full
555+
* collections. Invoke this method before performing a modification
556+
* test.
557557
*/
558558
public void resetFull() {
559559
this.setCollection(makeFullCollection());
@@ -562,6 +562,7 @@ public void resetFull() {
562562

563563
/**
564564
* Sets the collection.
565+
*
565566
* @param collection the Collection<E> to set
566567
*/
567568
public void setCollection(final Collection<E> collection) {
@@ -570,6 +571,7 @@ public void setCollection(final Collection<E> collection) {
570571

571572
/**
572573
* Sets the confirmed.
574+
*
573575
* @param confirmed the Collection<E> to set
574576
*/
575577
public void setConfirmed(final Collection<E> confirmed) {

0 commit comments

Comments
 (0)