Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1234449

Vector class should provide a findElement method

XMLWordPrintable

    • 1.1
    • sparc
    • solaris_2.4
    • Not verified

      [pgt, 1/16/1995]

      The present interface to the Vector class does not provide a method
      to reliably find an element in the Vector. So, I would like to propose
      the following extension:
      Object findElement( Object elem )

      This could be implemented as:

      int index = indexOf( elem ) ;

      return index >= 0 ? elementAt( index ) : null ;

      This needs to be a synchronized method, otherwise the code fragment contains
      a race condition.


            fyellinsunw Frank Yellin (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: