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

Vector class should provide a findElement method

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      sparc
    • OS:
      solaris_2.4
    • Verification:
      Not verified

      Description

      [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.


        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: