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

StringBuffer should implement equals(Object), should take String, CharSequence

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description



      Name: rmT116609 Date: 08/03/2004


      A DESCRIPTION OF THE REQUEST :
      Class java.lang.StringBuffer does not override method equals(Object). It
      probably should define equals(...) to compare the string value currently
      represented by the StringBuffer with the string value represented by the
      argument.

      It should obviously accept StringBufer objects.

      It should accept String objects.

      It should probably accept CharSequence objects.

      Possibly it should also accept character array objects.




      JUSTIFICATION :
      Currently, there doesn't seem to be any efficient and convenient way to
      compare the string represented by a string buffer with another string,
      especially one represented by a String object.

      You could use:
         string.equals( stringBuffer.toString() )
      but that (inefficiently) creates a second String object (which shouldn't be
      necessary just to compare the represented strings).



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      See proposal in Description section.
      ACTUAL -
      See description of current (main) option in Justification section.


      (Incident Review ID: 295726)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              martin Martin Buchholz
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: