[Issue 482] New - SequenceList duplicates first element if element is a sequence value

View: New views
2 Messages — Rating Filter:   Alert me  

[Issue 482] New - SequenceList duplicates first element if element is a sequence value

by rasss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://glazedlists.dev.java.net/issues/show_bug.cgi?id=482
                 Issue #|482
                 Summary|SequenceList duplicates first element if element is a
                        |sequence value
               Component|glazedlists
                 Version|current
                Platform|All
              OS/Version|All
                     URL|
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|core
             Assigned to|jessewilson
             Reported by|rasss






------- Additional comments from rasss@... Mon Oct 12 18:35:15 +0000 2009 -------
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);
        }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@...
For additional commands, e-mail: issues-help@...


[Issue 482] SequenceList duplicates first element if element is a sequence value

by rasss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://glazedlists.dev.java.net/issues/show_bug.cgi?id=482






------- Additional comments from rasss@... Mon Oct 12 18:44:33 +0000 2009 -------
Created an attachment (id=49)
Test Case


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@...
For additional commands, e-mail: issues-help@...