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

SetUniqueList set method use corrupts uniqness

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment