< prev index next >

## src/java.desktop/share/classes/javax/swing/DefaultListModel.java

Print this page

    rev 48358 : Work in progress for JDK-6303622
    Use generic in Swing components like JComboBox
    1. Added generic return type and parameter type for JComboBox.
    2. Modified JList related classes as well.

    @@ -97,11 +97,11 @@
          * else an <code>IndexOutOfBoundsException</code> is thrown.
          *
          * @param   anArray   the array into which the components get copied
          * @see Vector#copyInto(Object[])
          */
    -    public void copyInto(Object anArray[]) {
    +    public void copyInto(E anArray[]) {
             delegate.copyInto(anArray);
         }

         /**
          * Trims the capacity of this list to be the list's current size.

    @@ -189,11 +189,11 @@
          * @param   elem   an object
          * @return  <code>true</code> if the specified object
          *          is the same as a component in this list
          * @see Vector#contains(Object)
          */
    -    public boolean contains(Object elem) {
    +    public boolean contains(E elem) {
             return delegate.contains(elem);
         }

         /**
          * Searches for the first occurrence of <code>elem</code>.

    @@ -201,11 +201,11 @@
          * @param   elem   an object
          * @return  the index of the first occurrence of the argument in this
          *          list; returns <code>-1</code> if the object is not found
          * @see Vector#indexOf(Object)
          */
    -    public int indexOf(Object elem) {
    +    public int indexOf(E elem) {
             return delegate.indexOf(elem);
         }

         /**
          * Searches for the first occurrence of <code>elem</code>, beginning

    @@ -216,11 +216,11 @@
          * @return  the index where the first occurrence of <code>elem</code>
          *          is found after <code>index</code>; returns <code>-1</code>
          *          if the <code>elem</code> is not found in the list
          * @see Vector#indexOf(Object,int)
          */
    -     public int indexOf(Object elem, int index) {
    +     public int indexOf(E elem, int index) {
             return delegate.indexOf(elem, index);
         }

         /**
          * Returns the index of the last occurrence of <code>elem</code>.

    @@ -228,11 +228,11 @@
          * @param   elem   the desired component
          * @return  the index of the last occurrence of <code>elem</code>
          *          in the list; returns <code>-1</code> if the object is not found
          * @see Vector#lastIndexOf(Object)
          */
    -    public int lastIndexOf(Object elem) {
    +    public int lastIndexOf(E elem) {
             return delegate.lastIndexOf(elem);
         }

         /**
          * Searches backwards for <code>elem</code>, starting from the

    @@ -243,11 +243,11 @@
          * @return the index of the last occurrence of the <code>elem</code>
          *          in this list at position less than <code>index</code>;
          *          returns <code>-1</code> if the object is not found
          * @see Vector#lastIndexOf(Object,int)
          */
    -    public int lastIndexOf(Object elem, int index) {
    +    public int lastIndexOf(E elem, int index) {
             return delegate.lastIndexOf(elem, index);
         }

         /**
          * Returns the component at the specified index.

    @@ -376,11 +376,11 @@
          * @param   obj   the component to be removed
          * @return  <code>true</code> if the argument was a component of this
          *          list; <code>false</code> otherwise
          * @see Vector#removeElement(Object)
          */
    -    public boolean removeElement(Object obj) {
    +    public boolean removeElement(E obj) {
             int index = indexOf(obj);
             boolean rv = delegate.removeElement(obj);
             if (index >= 0) {
                 fireIntervalRemoved(this, index, index);
             }

< prev index next >