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

VectorEnumerator should implement clone() and equals()

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: krT82822 Date: 06/08/99


      The Enumeration returned by Vector (class VectorEnumerator in 1.1.x; it's an anonymous inner class in 1.2.x) does not implement clone() or equals(). There's no reason it can't, and it gets in the way of using Enumerations with STL/JGL-like generic range-based algorithms, e.g.:

        static void print(Enumeration begin, Enumeration end) {
          Enumeration e = begin.clone(); // don't modify the user's Enumeration
          while (!e.equals(end)) System.out.println(e.nextElement());
        }

      (This assumes bug #4098033 has been addressed; otherwise Enumeration has to add clone() and inherit from Cloneable.)

      The same goes for HashtableEnumerator and probably a bunch of other things in the library, as well as Iterators.
      (Review ID: 84058)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              jjb Josh Bloch
              Reporter:
              kryansunw Kevin Ryan (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: