jdk/src/share/classes/sun/swing/BakedArrayList.java
changeset 25565 ce603b34c98d
parent 22644 965bba13a5f0
equal deleted inserted replaced
25564:871d3490f14d 25565:ce603b34c98d
    42  * only ever compare a BakedArrayList to another BakedArrayList.
    42  * only ever compare a BakedArrayList to another BakedArrayList.
    43  *
    43  *
    44  * @author Scott Violet
    44  * @author Scott Violet
    45  */
    45  */
    46 @SuppressWarnings("serial") // JDK-implementation class
    46 @SuppressWarnings("serial") // JDK-implementation class
    47 public class BakedArrayList extends ArrayList<Object> {
    47 public class BakedArrayList<E> extends ArrayList<E> {
    48     /**
    48     /**
    49      * The cached hashCode.
    49      * The cached hashCode.
    50      */
    50      */
    51     private int _hashCode;
    51     private int _hashCode;
    52 
    52 
    53     public BakedArrayList(int size) {
    53     public BakedArrayList(int size) {
    54         super(size);
    54         super(size);
    55     }
    55     }
    56 
    56 
    57     public BakedArrayList(java.util.List<?> data) {
    57     public BakedArrayList(java.util.List<? extends E> data) {
    58         this(data.size());
    58         this(data.size());
    59         for (int counter = 0, max = data.size(); counter < max; counter++){
    59         for (int counter = 0, max = data.size(); counter < max; counter++){
    60             add(data.get(counter));
    60             add(data.get(counter));
    61         }
    61         }
    62         cacheHashCode();
    62         cacheHashCode();
    76     public int hashCode() {
    76     public int hashCode() {
    77         return _hashCode;
    77         return _hashCode;
    78     }
    78     }
    79 
    79 
    80     public boolean equals(Object o) {
    80     public boolean equals(Object o) {
    81         BakedArrayList list = (BakedArrayList)o;
    81         @SuppressWarnings("unchecked")
       
    82         BakedArrayList<E> list = (BakedArrayList)o;
    82         int size = size();
    83         int size = size();
    83 
    84 
    84         if (list.size() != size) {
    85         if (list.size() != size) {
    85             return false;
    86             return false;
    86         }
    87         }