This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push: new 094521f77 Javadoc 094521f77 is described below commit 094521f776d3f05f69999cb01b6822066e9d7d97 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Jun 23 14:59:39 2024 -0400 Javadoc --- .../collections4/functors/DefaultEquator.java | 5 +++ .../collections4/functors/ExceptionClosure.java | 5 +++ .../collections4/functors/ExceptionFactory.java | 5 +++ .../collections4/functors/ExceptionPredicate.java | 5 +++ .../functors/ExceptionTransformer.java | 5 +++ .../collections4/functors/FalsePredicate.java | 5 +++ .../commons/collections4/functors/NOPClosure.java | 5 +++ .../collections4/functors/NOPTransformer.java | 5 +++ .../collections4/functors/NotNullPredicate.java | 5 +++ .../collections4/functors/NullPredicate.java | 5 +++ .../functors/StringValueTransformer.java | 5 +++ .../collections4/functors/TruePredicate.java | 5 +++ .../collections4/keyvalue/AbstractKeyValue.java | 12 +++++++ .../collections4/map/AbstractHashedMap.java | 39 +++++++++++++++++++++- 14 files changed, 110 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java b/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java index 4a76fc8ee..59a5d3fea 100644 --- a/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java +++ b/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java @@ -76,6 +76,11 @@ public class DefaultEquator<T> implements Equator<T>, Serializable { return o == null ? HASHCODE_NULL : o.hashCode(); } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java index ee366661e..1b5196d25 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java @@ -63,6 +63,11 @@ public final class ExceptionClosure<E> implements Closure<E>, Serializable { throw new FunctorException("ExceptionClosure invoked"); } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java index 518551bce..04925c9a4 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java @@ -63,6 +63,11 @@ public final class ExceptionFactory<T> implements Factory<T>, Serializable { throw new FunctorException("ExceptionFactory invoked"); } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java index 3348cbba4..bf46f60ea 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java @@ -65,6 +65,11 @@ public final class ExceptionPredicate<T> implements Predicate<T>, Serializable { throw new FunctorException("ExceptionPredicate invoked"); } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java index 68deb5697..b5978605e 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java @@ -53,6 +53,11 @@ public final class ExceptionTransformer<I, O> implements Transformer<I, O>, Seri private ExceptionTransformer() { } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java b/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java index b52a0a0a0..184234c6b 100644 --- a/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java @@ -63,6 +63,11 @@ public final class FalsePredicate<T> implements Predicate<T>, Serializable { return false; } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java b/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java index 5bfb050b4..252221e7f 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java @@ -61,6 +61,11 @@ public final class NOPClosure<E> implements Closure<E>, Serializable { // do nothing } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java b/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java index 306792e13..e025fc553 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java @@ -51,6 +51,11 @@ public class NOPTransformer<T> implements Transformer<T, T>, Serializable { private NOPTransformer() { } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java b/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java index e8ebbf604..6913cfdb4 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java @@ -63,6 +63,11 @@ public final class NotNullPredicate<T> implements Predicate<T>, Serializable { return object != null; } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java b/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java index 8aca8c870..93820fc54 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java @@ -63,6 +63,11 @@ public final class NullPredicate<T> implements Predicate<T>, Serializable { return object == null; } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/StringValueTransformer.java b/src/main/java/org/apache/commons/collections4/functors/StringValueTransformer.java index 3205edfb2..e39caa6cf 100644 --- a/src/main/java/org/apache/commons/collections4/functors/StringValueTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/StringValueTransformer.java @@ -52,6 +52,11 @@ public final class StringValueTransformer<T> implements Transformer<T, String>, private StringValueTransformer() { } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java b/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java index a17d319b2..ef1dd6a94 100644 --- a/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java @@ -63,6 +63,11 @@ public final class TruePredicate<T> implements Predicate<T>, Serializable { return true; } + /** + * Returns the singleton instance. + * + * @return the singleton instance. + */ private Object readResolve() { return INSTANCE; } diff --git a/src/main/java/org/apache/commons/collections4/keyvalue/AbstractKeyValue.java b/src/main/java/org/apache/commons/collections4/keyvalue/AbstractKeyValue.java index 1a743f315..3c13e71d0 100644 --- a/src/main/java/org/apache/commons/collections4/keyvalue/AbstractKeyValue.java +++ b/src/main/java/org/apache/commons/collections4/keyvalue/AbstractKeyValue.java @@ -64,12 +64,24 @@ public abstract class AbstractKeyValue<K, V> implements KeyValue<K, V> { return value; } + /** + * Sets the key. + * + * @param key The key. + * @return The previous key. + */ protected K setKey(final K key) { final K old = this.key; this.key = key; return old; } + /** + * Sets the value. + * + * @param value The value. + * @return The previous value. + */ protected V setValue(final V value) { final V old = this.value; this.value = value; diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java index 8e458ad97..1e344c690 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java @@ -67,9 +67,15 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab * @param <V> the type of the values in the map */ protected static class EntrySet<K, V> extends AbstractSet<Map.Entry<K, V>> { + /** The parent map */ private final AbstractHashedMap<K, V> parent; + /** + * Constructs a new instance. + * + * @param parent The parent map. + */ protected EntrySet(final AbstractHashedMap<K, V> parent) { this.parent = parent; } @@ -112,6 +118,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab return parent.size(); } } + /** * EntrySet iterator. * @@ -120,6 +127,11 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab */ protected static class EntrySetIterator<K, V> extends HashIterator<K, V> implements Iterator<Map.Entry<K, V>> { + /** + * Constructs a new instance. + * + * @param parent The parent map. + */ protected EntrySetIterator(final AbstractHashedMap<K, V> parent) { super(parent); } @@ -129,6 +141,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab return super.nextEntry(); } } + /** * HashEntry used to store the data. * <p> @@ -136,17 +149,22 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab * then you will not be able to access the protected fields. * The {@code entryXxx()} methods on {@code AbstractHashedMap} exist * to provide the necessary access. + * </p> * * @param <K> the type of the keys * @param <V> the type of the values */ protected static class HashEntry<K, V> implements Map.Entry<K, V>, KeyValue<K, V> { + /** The next entry in the hash chain */ protected HashEntry<K, V> next; + /** The hash code of the key */ protected int hashCode; + /** The key */ protected Object key; + /** The value */ protected Object value; @@ -206,7 +224,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab } } /** - * Base Iterator + * Base Iterator. * * @param <K> the type of the keys in the map * @param <V> the type of the values in the map @@ -215,12 +233,16 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab /** The parent map */ private final AbstractHashedMap<K, V> parent; + /** The current index into the array of buckets */ private int hashIndex; + /** The last returned entry */ private HashEntry<K, V> last; + /** The next entry */ private HashEntry<K, V> next; + /** The modification count expected */ private int expectedModCount; @@ -285,6 +307,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab return "Iterator[]"; } } + /** * MapIterator implementation. * @@ -329,6 +352,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab return current.setValue(value); } } + /** * KeySet implementation. * @@ -387,6 +411,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab return super.nextEntry().getKey(); } } + /** * Values implementation. * @@ -420,6 +445,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab return parent.size(); } } + /** * Values iterator. * @@ -438,11 +464,22 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab } } + /** Exception message. */ protected static final String NO_NEXT_ENTRY = "No next() entry in the iteration"; + + /** Exception message. */ protected static final String NO_PREVIOUS_ENTRY = "No previous() entry in the iteration"; + + /** Exception message. */ protected static final String REMOVE_INVALID = "remove() can only be called once after next()"; + + /** Exception message. */ protected static final String GETKEY_INVALID = "getKey() can only be called after next() and before remove()"; + + /** Exception message. */ protected static final String GETVALUE_INVALID = "getValue() can only be called after next() and before remove()"; + + /** Exception message. */ protected static final String SETVALUE_INVALID = "setValue() can only be called after next() and before remove()"; /** The default capacity to use */