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

SetUniqueList.subList().contains() method checks against full parent list, not sublist range

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.2.2, 4.0-alpha1, 4.0
    • Component/s: List
    • Labels:
      None

      Description

      The view returned by the subList() method of a SetUniqueList checks contains() against the set of the original list.

      As shown by the following test snippet.

      List list = new ArrayList();
      List uniqueList = SetUniqueList.decorate(list);
      uniqueList.add("Hello");
      uniqueList.add("World");
      List subList = list.subList(0, 0);
      List subUniqueList = uniqueList.subList(0, 0);
      assertFalse(subList.contains("World")); // passes
      assertFalse(subUniqueList.contains("World")); // fails

        Attachments

        1. COLLECTIONS-307.patch
          3 kB
          Henri Yandell

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              chsemrau Christian Semrau
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: