diff options
Diffstat (limited to 'libjava/java/util/AbstractList.java')
-rw-r--r-- | libjava/java/util/AbstractList.java | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/libjava/java/util/AbstractList.java b/libjava/java/util/AbstractList.java index 1c2d1de65ab..be0bc307a56 100644 --- a/libjava/java/util/AbstractList.java +++ b/libjava/java/util/AbstractList.java @@ -1,5 +1,5 @@ /* AbstractList.java -- Abstract implementation of most of List - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -237,20 +237,22 @@ public abstract class AbstractList extends AbstractCollection implements List } /** - * Obtain a hash code for this list. In order to obey the general contract of - * the hashCode method of class Object, this value is calculated as follows: - * <pre> - * hashCode = 1; - * Iterator i = list.iterator(); - * while (i.hasNext()) - * { - * Object obj = i.next(); - * hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode()); - * } - * </pre> + * Obtains a hash code for this list. In order to obey the general + * contract of the hashCode method of class Object, this value is + * calculated as follows: + * +<pre>hashCode = 1; +Iterator i = list.iterator(); +while (i.hasNext()) +{ + Object obj = i.next(); + hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode()); +}</pre> + * * This ensures that the general contract of Object.hashCode() is adhered to. * * @return the hash code of this list + * * @see Object#hashCode() * @see #equals(Object) */ @@ -611,19 +613,21 @@ public abstract class AbstractList extends AbstractCollection implements List /** * This class follows the implementation requirements set forth in - * {@link AbstractList#subList(int, int)}. Some compilers have problems - * with AbstractList.this.modCount if this class is nested in AbstractList, - * even though the JLS defines that to be legal, so we make it a top-level - * class. + * {@link AbstractList#subList(int, int)}. It matches Sun's implementation + * by using a non-public top-level class in the same package. * * @author Original author unknown * @author Eric Blake <ebb9@email.byu.edu> */ class SubList extends AbstractList { - private final AbstractList backingList; - private final int offset; - private int size; + // Package visible, for use by iterator. + /** The original list. */ + final AbstractList backingList; + /** The index of the first element of the sublist. */ + final int offset; + /** The size of the sublist. */ + int size; /** * Construct the sublist. @@ -647,8 +651,8 @@ class SubList extends AbstractList * @throws ConcurrentModificationException if the backing list has been * modified externally to this sublist */ - // This will get inlined, since it is private. - private void checkMod() + // This can be inlined. Package visible, for use by iterator. + void checkMod() { if (modCount != backingList.modCount) throw new ConcurrentModificationException(); |