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@...