jdk/src/share/classes/java/awt/Choice.java

Print this page

        

@@ -83,11 +83,11 @@
      * @see #getItem(int)
      * @see #getItemCount()
      * @see #insert(String, int)
      * @see #remove(String)
      */
-    Vector pItems;
+    Vector<String> pItems;
 
     /**
      * The index of the current choice for this <code>Choice</code>
      * or -1 if nothing is selected.
      * @serial

@@ -127,11 +127,11 @@
      * @see       #select(int)
      * @see       #select(java.lang.String)
      */
     public Choice() throws HeadlessException {
         GraphicsEnvironment.checkHeadless();
-        pItems = new Vector();
+        pItems = new Vector<>();
     }
 
     /**
      * Constructs a name for this component.  Called by
      * <code>getName</code> when the name is <code>null</code>.

@@ -189,11 +189,11 @@
     /*
      * This is called by the native code, so client code can't
      * be called on the toolkit thread.
      */
     final String getItemImpl(int index) {
-        return (String)pItems.elementAt(index);
+        return pItems.elementAt(index);
     }
 
     /**
      * Adds an item to this <code>Choice</code> menu.
      * @param      item    the item to be added

@@ -522,11 +522,11 @@
      * @see           java.awt.event.ItemEvent
      * @see           java.awt.event.ItemListener
      * @since 1.4
      */
     public synchronized ItemListener[] getItemListeners() {
-        return (ItemListener[])(getListeners(ItemListener.class));
+        return getListeners(ItemListener.class);
     }
 
     /**
      * Returns an array of all the objects currently registered
      * as <code><em>Foo</em>Listener</code>s