glazedlists
  1. glazedlists
  2. GLAZEDLISTS-482

SequenceList duplicates first element if element is a sequence value

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: core
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      482

      Description

      The SequenceList duplicates the first element iff the first element of the source list is a sequence value
      itself. The problem seems to come from the implementation of updateSequence. The if statement at line
      220 inserts the same element twice into the result list (nextSequenceValue == previousSequenceValue).

      The following test outputs: [1,1,2]

      instead of [1,2]

      public void testSequenceList() {
      EventList<Integer> src = new BasicEventList<Integer>();
      src.add(1);
      src.add(2);

      SequenceList<Integer> integers = new SequenceList<Integer>(src, new Sequencer<Integer>() {
      public Integer next(Integer value)

      { return value + 1; }

      public Integer previous(Integer value)

      { return value - 1; }

      });

      for (Integer value : integers)

      { System.out.println(value); }

      }

        Activity

        Hide
        rasss added a comment -

        Created an attachment (id=49)
        Test Case

        Show
        rasss added a comment - Created an attachment (id=49) Test Case

          People

          • Assignee:
            jessewilson
            Reporter:
            rasss
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: