Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-304

SetUniqueList set method use corrupts uniqness

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2
    • 3.2.2, 4.0-alpha1, 4.0
    • None
    • None
    • JDK 1.6/Windows/Eclipse Ganymede

    Description

      When set method is used to put element (Strawberry) on list, then it is possible to add the same element (Strawberry) with add method. Also you cannot add element (Lemon) that has been once removed with set method. Reproduction code below:

      List<String> list = new LinkedList<String>();
      SetUniqueList decoratedList = SetUniqueList.decorate(list);

      decoratedList.add("Apple");
      decoratedList.add("Lemon");
      decoratedList.add("Orange");

      System.out.println(decoratedList.toString());

      decoratedList.set(1, "Strawberry");

      System.out.println(decoratedList.toString());

      decoratedList.add(1, "Strawberry");

      System.out.println(decoratedList.toString());

      decoratedList.add(1, "Lemon");

      System.out.println(decoratedList.toString());

      Attachments

        1. COLLECTIONS-304.patch
          2 kB
          Henri Yandell
        2. Commons-304-test.diff
          1 kB
          Bjorn Townsend

        Activity

          People

            Unassigned Unassigned
            raffig RafaƂ Figas
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: