You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by pj...@apache.org on 2002/08/22 03:50:55 UTC
cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/primitives AbstractIntArrayList.java AbstractIntList.java AbstractLongArrayList.java AbstractLongList.java AbstractShortArrayList.java AbstractShortList.java IntArrayList.java LongArrayList.java ShortArrayList.java UnsignedByteArrayList.java UnsignedIntArrayList.java UnsignedShortArrayList.java
pjack 2002/08/21 18:50:55
Modified: collections/src/java/org/apache/commons/collections/primitives
AbstractIntArrayList.java AbstractIntList.java
AbstractLongArrayList.java AbstractLongList.java
AbstractShortArrayList.java AbstractShortList.java
IntArrayList.java LongArrayList.java
ShortArrayList.java UnsignedByteArrayList.java
UnsignedIntArrayList.java
UnsignedShortArrayList.java
Log:
Added better class-level documentation as suggested by Jonathan Carlson.
Also provided default implementations for many of the abstract methods
in Abstract*List.
Revision Changes Path
1.5 +11 -5 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractIntArrayList.java
Index: AbstractIntArrayList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractIntArrayList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractIntArrayList.java 21 Aug 2002 23:54:18 -0000 1.4
+++ AbstractIntArrayList.java 22 Aug 2002 01:50:54 -0000 1.5
@@ -69,7 +69,13 @@
import java.util.ListIterator;
/**
- * Abstract base class for lists backed by an <Code>int</Code> array.
+ * Abstract base class for lists of primitive <Code>int</Code> elements
+ * backed by an array.<P>
+ *
+ * Extending this class is essentially the same as extending its superclass
+ * ({@link AbstractIntList}. However, this class assumes that the
+ * primitive values will be stored in an underlying primitive array, and
+ * provides methods for manipulating the capacity of that array.<P>
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
1.3 +94 -35 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractIntList.java
Index: AbstractIntList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractIntList.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractIntList.java 21 Aug 2002 23:54:18 -0000 1.2
+++ AbstractIntList.java 22 Aug 2002 01:50:54 -0000 1.3
@@ -69,7 +69,26 @@
import java.util.ListIterator;
/**
- * Abstract base class for lists backed by an <Code>int</Code> array.
+ * Abstract base class for lists of primitive <Code>int</Code> elements.<P>
+ *
+ * The {@link List} methods are all implemented, but they forward to
+ * abstract methods that operate on <Code>int</Code> elements. For
+ * instance, the {@link #get(int)} method simply forwards to
+ * {@link #getInt(int)}. The primitive <Code>int</Code> that is
+ * returned from {@link #getInt(int)} is wrapped in a {@link java.lang.Integer}
+ * and returned from {@link #get(int)}.<p>
+ *
+ * Concrete implementations offer substantial memory savings by not storing
+ * primitives as wrapped objects. If you excuslively use the primitive
+ * signatures, there can also be substantial performance gains, since
+ * temporary wrapper objects do not need to be created.<p>
+ *
+ * To implement a read-only list of <Code>int</Code> elements, you need
+ * only implement the {@link #getInt(int)} and {@link #size()} methods.
+ * To implement a modifiable list, you will also need to implement the
+ * {@link #setInt(int,int)}, {@link #addInt(int,int)},
+ * {@link #removeIntAt(int)} and {@link #clear()} methods. You may want
+ * to override the other methods to increase performance.<P>
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
@@ -98,40 +117,65 @@
*/
abstract public int getInt(int index);
-
+ //--------------------------------------------------------------- Accessors
+
/**
* Returns <Code>true</Code> if this list contains the given
- * <Code>int</Code> element.
+ * <Code>int</Code> element. The default implementation uses
+ * {@link #indexOfInt(int)} to determine if the given value is
+ * in this list.
*
* @param value the element to search for
* @return true if this list contains the given value, false otherwise
*/
- abstract public boolean containsInt(int value);
-
+ public boolean containsInt(int value) {
+ return indexOfInt(value) >= 0;
+ }
/**
* Returns the first index of the given <Code>int</Code> element, or
- * -1 if the value is not in this list.
+ * -1 if the value is not in this list. The default implementation is:
+ *
+ * <pre>
+ * for (int i = 0; i < size(); i++) {
+ * if (getInt(i) == value) return i;
+ * }
+ * return -1;
+ * </pre>
*
* @param value the element to search for
* @return the first index of that element, or -1 if the element is
* not in this list
*/
- abstract public int indexOfInt(int value);
-
+ public int indexOfInt(int value) {
+ for (int i = 0; i < size(); i++) {
+ if (getInt(i) == value) return i;
+ }
+ return -1;
+ }
/**
* Returns the last index of the given <Code>int</Code> element, or
- * -1 if the value is not in this list.
+ * -1 if the value is not in this list. The default implementation is:
+ *
+ * <pre>
+ * for (int i = size() - 1; i >= 0; i--) {
+ * if (getInt(i) == value) return i;
+ * }
+ * return -1;
+ * </pre>
*
* @param value the element to search for
* @return the last index of that element, or -1 if the element is
* not in this list
*/
- abstract public int lastIndexOfInt(int value);
+ public int lastIndexOfInt(int value) {
+ for (int i = size() - 1; i >= 0; i--) {
+ if (getInt(i) == value) return i;
+ }
+ return -1;
+ }
- //--------------------------------------------------------------- Accessors
-
/**
* Returns <code>new Integer({@link #getInt getInt(index)})</code>.
*
@@ -213,15 +257,6 @@
abstract public int setInt(int index, int value);
/**
- * Adds the given <Code>int</Code> value to the end of this list.
- *
- * @param value the value to add
- * @return true, always
- */
- abstract public boolean addInt(int value);
-
-
- /**
* Inserts the given <Code>int</Code> value into this list at the
* specified index.
*
@@ -243,24 +278,48 @@
*/
abstract public int removeIntAt(int index);
+ /**
+ * Removes all <Code>int</Code> values from this list.
+ */
+ abstract public void clear();
+ //--------------------------------------------------------------- Modifiers
+
/**
- * Removes the first occurrence of the given <Code>int</COde> value
- * from this list.
+ * Adds the given <Code>int</Code> value to the end of this list.
+ * The default implementation invokes {@link #addInt(int,int)
+ * addInt(size(), value)}.
*
- * @param value the value to remove
- * @return true if this list contained that value and removed it,
- * or false if this list didn't contain the value
+ * @param value the value to add
+ * @return true, always
*/
- abstract public boolean removeInt(int value);
+ public boolean addInt(int value) {
+ addInt(size(), value);
+ return true;
+ }
/**
- * Removes all <Code>int</Code> values from this list.
+ * Removes the first occurrence of the given <Code>int</Code> value
+ * from this list. The default implementation is:
+ *
+ * <pre>
+ * int i = indexOfInt(value);
+ * if (i < 0) return false;
+ * removeIntAt(i);
+ * return true;
+ * </pre>
+ *
+ * @param value the value to remove
+ * @return true if this list contained that value and removed it,
+ * or false if this list didn't contain the value
*/
- abstract public void clear();
+ public boolean removeInt(int value) {
+ int i = indexOfInt(value);
+ if (i < 0) return false;
+ removeIntAt(i);
+ return true;
+ }
- //--------------------------------------------------------------- Modifiers
-
/**
* Returns <code>new Integer({@link #setInt(int,int)
* setInt(index,((Integer)value).intValue())})</code>.
1.5 +11 -5 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractLongArrayList.java
Index: AbstractLongArrayList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractLongArrayList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractLongArrayList.java 21 Aug 2002 23:54:18 -0000 1.4
+++ AbstractLongArrayList.java 22 Aug 2002 01:50:54 -0000 1.5
@@ -69,7 +69,13 @@
import java.util.ListIterator;
/**
- * Abstract base class for lists backed by a <Code>long</Code> array.
+ * Abstract base class for lists of primitive <Code>long</Code> elements
+ * backed by an array.<P>
+ *
+ * Extending this class is essentially the same as extending its superclass
+ * ({@link AbstractLongList}. However, this class assumes that the
+ * primitive values will be stored in an underlying primitive array, and
+ * provides methods for manipulating the capacity of that array.<P>
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
1.3 +94 -30 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractLongList.java
Index: AbstractLongList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractLongList.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractLongList.java 21 Aug 2002 23:54:18 -0000 1.2
+++ AbstractLongList.java 22 Aug 2002 01:50:54 -0000 1.3
@@ -69,7 +69,26 @@
import java.util.ListIterator;
/**
- * Abstract base class for lists backed by a <Code>long</Code> array.
+ * Abstract base class for lists of primitive <Code>long</Code> elements.<P>
+ *
+ * The {@link List} methods are all implemented, but they forward to
+ * abstract methods that operate on <Code>long</Code> elements. For
+ * instance, the {@link #get(int)} method simply forwards to
+ * {@link #getLong(int)}. The primitive <Code>long</Code> that is
+ * returned from {@link #getLong(int)} is wrapped in a {@link java.lang.Long}
+ * and returned from {@link #get(int)}.<p>
+ *
+ * Concrete implementations offer substantial memory savings by not storing
+ * primitives as wrapped objects. If you excuslively use the primitive
+ * signatures, there can also be substantial performance gains, since
+ * temporary wrapper objects do not need to be created.<p>
+ *
+ * To implement a read-only list of <Code>long</Code> elements, you need
+ * only implement the {@link #getLong(int)} and {@link #size()} methods.
+ * To implement a modifiable list, you will also need to implement the
+ * {@link #setLong(int,long)}, {@link #addLong(int,long)},
+ * {@link #removeLongAt(int)} and {@link #clear()} methods. You may want
+ * to override the other methods to increase performance.<P>
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
@@ -97,37 +116,65 @@
*/
abstract public long getLong(int index);
+ //--------------------------------------------------------------- Accessors
+
/**
* Returns <Code>true</Code> if this list contains the given
- * <Code>long</Code> element.
+ * <Code>long</Code> element. The default implementation uses
+ * {@link #indexOfLong(long)} to determine if the given value is
+ * in this list.
*
* @param value the element to search for
* @return true if this list contains the given value, false otherwise
*/
- abstract public boolean containsLong(long value);
+ public boolean containsLong(long value) {
+ return indexOfLong(value) >= 0;
+ }
/**
* Returns the first index of the given <Code>long</Code> element, or
- * -1 if the value is not in this list.
+ * -1 if the value is not in this list. The default implementation is:
+ *
+ * <pre>
+ * for (int i = 0; i < size(); i++) {
+ * if (getLong(i) == value) return i;
+ * }
+ * return -1;
+ * </pre>
*
* @param value the element to search for
* @return the first index of that element, or -1 if the element is
* not in this list
*/
- abstract public int indexOfLong(long value);
+ public int indexOfLong(long value) {
+ for (int i = 0; i < size(); i++) {
+ if (getLong(i) == value) return i;
+ }
+ return -1;
+ }
/**
* Returns the last index of the given <Code>long</Code> element, or
- * -1 if the value is not in this list.
+ * -1 if the value is not in this list. The default implementation is:
+ *
+ * <pre>
+ * for (int i = size() - 1; i >= 0; i--) {
+ * if (getLong(i) == value) return i;
+ * }
+ * return -1;
+ * </pre>
*
* @param value the element to search for
* @return the last index of that element, or -1 if the element is
* not in this list
*/
- abstract public int lastIndexOfLong(long value);
+ public int lastIndexOfLong(long value) {
+ for (int i = size() - 1; i >= 0; i--) {
+ if (getLong(i) == value) return i;
+ }
+ return -1;
+ }
- //--------------------------------------------------------------- Accessors
-
/**
* Returns <code>new Long({@link #getLong getLong(index)})</code>.
*
@@ -209,14 +256,6 @@
abstract public long setLong(int index, long value);
/**
- * Adds the given <Code>long</Code> value to the end of this list.
- *
- * @param value the value to add
- * @return true, always
- */
- abstract public boolean addLong(long value);
-
- /**
* Inserts the given <Code>long</Code> value into this list at the
* specified index.
*
@@ -238,22 +277,47 @@
abstract public long removeLongAt(int index);
/**
+ * Removes all <Code>long</Code> values from this list.
+ */
+ abstract public void clear();
+
+ //--------------------------------------------------------------- Modifiers
+
+ /**
+ * Adds the given <Code>long</Code> value to the end of this list.
+ * The default implementation invokes {@link #addLong(int,long)
+ * addLong(size(), value)}.
+ *
+ * @param value the value to add
+ * @return true, always
+ */
+ public boolean addLong(long value) {
+ addLong(size(), value);
+ return true;
+ }
+
+ /**
* Removes the first occurrence of the given <Code>long</Code> value
- * from this list.
+ * from this list. The default implementation is:
+ *
+ * <pre>
+ * int i = indexOfLong(value);
+ * if (i < 0) return false;
+ * removeLongAt(i);
+ * return true;
+ * </pre>
*
* @param value the value to remove
* @return true if this list contained that value and removed it,
* or false if this list didn't contain the value
*/
- abstract public boolean removeLong(long value);
-
- /**
- * Removes all <Code>long</Code> values from this list.
- */
- abstract public void clear();
+ public boolean removeLong(long value) {
+ int i = indexOfLong(value);
+ if (i < 0) return false;
+ removeLongAt(i);
+ return true;
+ }
- //--------------------------------------------------------------- Modifiers
-
/**
* Returns <code>new Long({@link #setLong(int,long)
* setLong(index,((Long).longValue())})</code>.
1.5 +11 -5 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractShortArrayList.java
Index: AbstractShortArrayList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractShortArrayList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractShortArrayList.java 21 Aug 2002 23:54:18 -0000 1.4
+++ AbstractShortArrayList.java 22 Aug 2002 01:50:54 -0000 1.5
@@ -69,7 +69,13 @@
import java.util.ListIterator;
/**
- * Abstract base class for lists backed by a <Code>short</Code> array.
+ * Abstract base class for lists of primitive <Code>short</Code> elements
+ * backed by an array.<P>
+ *
+ * Extending this class is essentially the same as extending its superclass
+ * ({@link AbstractShortList}. However, this class assumes that the
+ * primitive values will be stored in an underlying primitive array, and
+ * provides methods for manipulating the capacity of that array.<P>
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
1.3 +94 -30 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractShortList.java
Index: AbstractShortList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractShortList.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractShortList.java 21 Aug 2002 23:54:18 -0000 1.2
+++ AbstractShortList.java 22 Aug 2002 01:50:54 -0000 1.3
@@ -69,7 +69,26 @@
import java.util.ListIterator;
/**
- * Abstract base class for lists backed by a <Code>short</Code> array.
+ * Abstract base class for lists of primitive <Code>short</Code> elements.<P>
+ *
+ * The {@link List} methods are all implemented, but they forward to
+ * abstract methods that operate on <Code>short</Code> elements. For
+ * instance, the {@link #get(int)} method simply forwards to
+ * {@link #getShort(int)}. The primitive <Code>short</Code> that is
+ * returned from {@link #getShort(int)} is wrapped in a {@link java.lang.Short}
+ * and returned from {@link #get(int)}.<p>
+ *
+ * Concrete implementations offer substantial memory savings by not storing
+ * primitives as wrapped objects. If you excuslively use the primitive
+ * signatures, there can also be substantial performance gains, since
+ * temporary wrapper objects do not need to be created.<p>
+ *
+ * To implement a read-only list of <Code>short</Code> elements, you need
+ * only implement the {@link #getShort(int)} and {@link #size()} methods.
+ * To implement a modifiable list, you will also need to implement the
+ * {@link #setShort(int,short)}, {@link #addShort(int,short)},
+ * {@link #removeShortAt(int)} and {@link #clear()} methods. You may want
+ * to override the other methods to increase performance.<P>
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
@@ -97,37 +116,65 @@
*/
abstract public short getShort(int index);
+ //--------------------------------------------------------------- Accessors
+
/**
* Returns <Code>true</Code> if this list contains the given
- * <Code>short</Code> element.
+ * <Code>short</Code> element. The default implementation uses
+ * {@link #indexOfShort(short)} to determine if the given value is
+ * in this list.
*
* @param value the element to search for
* @return true if this list contains the given value, false otherwise
*/
- abstract public boolean containsShort(short value);
+ public boolean containsShort(short value) {
+ return indexOfShort(value) >= 0;
+ }
/**
* Returns the first index of the given <Code>short</Code> element, or
- * -1 if the value is not in this list.
+ * -1 if the value is not in this list. The default implementation is:
+ *
+ * <pre>
+ * for (int i = 0; i < size(); i++) {
+ * if (getShort(i) == value) return i;
+ * }
+ * return -1;
+ * </pre>
*
* @param value the element to search for
* @return the first index of that element, or -1 if the element is
* not in this list
*/
- abstract public int indexOfShort(short value);
+ public int indexOfShort(short value) {
+ for (int i = 0; i < size(); i++) {
+ if (getShort(i) == value) return i;
+ }
+ return -1;
+ }
/**
* Returns the last index of the given <Code>short</Code> element, or
- * -1 if the value is not in this list.
+ * -1 if the value is not in this list. The default implementation is:
+ *
+ * <pre>
+ * for (int i = size() - 1; i >= 0; i--) {
+ * if (getShort(i) == value) return i;
+ * }
+ * return -1;
+ * </pre>
*
* @param value the element to search for
* @return the last index of that element, or -1 if the element is
* not in this list
*/
- abstract public int lastIndexOfShort(short value);
+ public int lastIndexOfShort(short value) {
+ for (int i = size() - 1; i >= 0; i--) {
+ if (getShort(i) == value) return i;
+ }
+ return -1;
+ }
- //--------------------------------------------------------------- Accessors
-
/**
* Returns <code>new Short({@link #getShort getShort(index)})</code>.
*
@@ -209,14 +256,6 @@
abstract public short setShort(int index, short value);
/**
- * Adds the given <Code>short</Code> value to the end of this list.
- *
- * @param value the value to add
- * @return true, always
- */
- abstract public boolean addShort(short value);
-
- /**
* Inserts the given <Code>short</Code> value into this list at the
* specified index.
*
@@ -238,22 +277,47 @@
abstract public short removeShortAt(int index);
/**
+ * Removes all <Code>short</Code> values from this list.
+ */
+ abstract public void clear();
+
+ //--------------------------------------------------------------- Modifiers
+
+ /**
+ * Adds the given <Code>short</Code> value to the end of this list.
+ * The default implementation invokes {@link #addShort(int,short)
+ * addShort(size(), value)}.
+ *
+ * @param value the value to add
+ * @return true, always
+ */
+ public boolean addShort(short value) {
+ addShort(size(), value);
+ return true;
+ }
+
+ /**
* Removes the first occurrence of the given <Code>short</Code> value
- * from this list.
+ * from this list. The default implementation is:
+ *
+ * <pre>
+ * int i = indexOfShort(value);
+ * if (i < 0) return false;
+ * removeShortAt(i);
+ * return true;
+ * </pre>
*
* @param value the value to remove
* @return true if this list contained that value and removed it,
* or false if this list didn't contain the value
*/
- abstract public boolean removeShort(short value);
-
- /**
- * Removes all <Code>short</Code> values from this list.
- */
- abstract public void clear();
+ public boolean removeShort(short value) {
+ int i = indexOfShort(value);
+ if (i < 0) return false;
+ removeShortAt(i);
+ return true;
+ }
- //--------------------------------------------------------------- Modifiers
-
/**
* Returns <code>new Short({@link #setShort(int,short)
* setShort(index,((Short)value.shortValue())})</code>.
1.5 +9 -5 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntArrayList.java
Index: IntArrayList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntArrayList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- IntArrayList.java 21 Aug 2002 23:54:18 -0000 1.4
+++ IntArrayList.java 22 Aug 2002 01:50:54 -0000 1.5
@@ -72,7 +72,11 @@
import java.util.ListIterator;
/**
- * A list of <Code>int</Code> elements.
+ * A list of <Code>int</Code> elements backed by an <Code>int</Code> array.
+ * This class implements the {@link List} interface for an array of
+ * <Code>int</Code> values. This class uses less memory than an
+ * {@link java.util.ArrayList} of {@link Integer} values and allows for
+ * better compile-time type checking.<P>
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
1.5 +9 -5 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/LongArrayList.java
Index: LongArrayList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/LongArrayList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LongArrayList.java 21 Aug 2002 23:54:18 -0000 1.4
+++ LongArrayList.java 22 Aug 2002 01:50:54 -0000 1.5
@@ -72,7 +72,11 @@
import java.util.ListIterator;
/**
- * A list of <Code>long</COde> elements.
+ * A list of <Code>long</Code> elements backed by a <Code>long</Code> array.
+ * This class implements the {@link List} interface for an array of
+ * <Code>long</Code> values. This class uses less memory than an
+ * {@link java.util.ArrayList} of {@link Long} values and allows for
+ * better compile-time type checking.<P>
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
1.5 +10 -6 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ShortArrayList.java
Index: ShortArrayList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ShortArrayList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ShortArrayList.java 21 Aug 2002 23:54:18 -0000 1.4
+++ ShortArrayList.java 22 Aug 2002 01:50:54 -0000 1.5
@@ -72,8 +72,12 @@
import java.util.ListIterator;
/**
- * A list of <Code>short</Code> elements.
- *
+ * A list of <Code>short</Code> elements backed by an <Code>short</Code> array.
+ * This class implements the {@link List} interface for an array of
+ * <Code>short</Code> values. This class uses less memory than an
+ * {@link java.util.ArrayList} of {@link Short} values and allows for
+ * better compile-time type checking.<P>
+ *
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
1.5 +10 -6 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedByteArrayList.java
Index: UnsignedByteArrayList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedByteArrayList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- UnsignedByteArrayList.java 21 Aug 2002 23:54:18 -0000 1.4
+++ UnsignedByteArrayList.java 22 Aug 2002 01:50:54 -0000 1.5
@@ -72,9 +72,13 @@
import java.util.ListIterator;
/**
- * A list of unsigned 8-bit values, stored in a <Code>short</Code> array.
+ * A list of unsigned 8-bit values backed by a <Code>byte</Code> array.
+ * The unsigned 8-bit values are converted to and from a signed 8-bit
+ * <code>byte</code> that's stored in the stored in the array.
* Mutators on this class will reject any <Code>short</Code> that does not
- * express an unsigned 8-bit value.
+ * express an unsigned 8-bit value. This implementation uses less memory
+ * than a {@link java.util.ArrayList} and offers better compile-time type
+ * checking.
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
1.5 +10 -6 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedIntArrayList.java
Index: UnsignedIntArrayList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedIntArrayList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- UnsignedIntArrayList.java 21 Aug 2002 23:54:18 -0000 1.4
+++ UnsignedIntArrayList.java 22 Aug 2002 01:50:54 -0000 1.5
@@ -72,9 +72,13 @@
import java.util.ListIterator;
/**
- * A list of unsigned 32-bit values, stored in a <Code>long</Code> array.
+ * A list of unsigned 32-bit values backed by an <Code>int</Code> array.
+ * The unsigned 32-bit values are converted to and from a signed 32-bit
+ * <code>int</code> that's stored in the stored in the array.
* Mutators on this class will reject any <Code>long</Code> that does not
- * express an unsigned 16-bit value.
+ * express an unsigned 32-bit value. This implementation uses less memory
+ * than a {@link java.util.ArrayList} and offers better compile-time type
+ * checking.
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
1.5 +10 -6 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedShortArrayList.java
Index: UnsignedShortArrayList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedShortArrayList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- UnsignedShortArrayList.java 21 Aug 2002 23:54:18 -0000 1.4
+++ UnsignedShortArrayList.java 22 Aug 2002 01:50:54 -0000 1.5
@@ -72,9 +72,13 @@
import java.util.ListIterator;
/**
- * A list of unsigned 16-bit values, stored in an <Code>int</Code> array.
+ * A list of unsigned 16-bit values backed by a <Code>short</Code> array.
+ * The unsigned 8-bit values are converted to and from a signed 16-bit
+ * <code>short</code> that's stored in the stored in the array.
* Mutators on this class will reject any <Code>int</Code> that does not
- * express an unsigned 16-bit value.
+ * express an unsigned 16-bit value. This implementation uses less memory
+ * than a {@link java.util.ArrayList} and offers better compile-time type
+ * checking.
*
* @version $Revision$ $Date$
* @author Rodney Waldhoff
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>