Different behavior in remove and removeAll? [message #574362] |
Tue, 18 August 2009 18:05 |
|
Hi list,
I've noticed that remove and removeAll don't seem to work quite the
same, as in this script:
var seq := Sequence { 0 };
seq.println('before, with number: ');
seq.remove(seq.first());
seq.println('after remove, with number: ');
seq.removeAll(Collection { seq.first() });
seq.println('after removeAll, with number: ');
var seq := Sequence { Sequence { 0 } };
seq.println('before, with nested sequence: ');
seq.remove(seq.first());
seq.println('after remove, with nested sequence: ');
seq.removeAll(Collection { seq.first() });
seq.println('after removeAll, with nested sequence: ');
If I run it, I get:
before, with number: Sequence {0}
after remove, with number: Sequence {0}
after removeAll, with number: Sequence {}
before, with nested sequence: Sequence {Sequence {0}}
after remove, with nested sequence: Sequence {Sequence {0}}
after removeAll, with nested sequence: Sequence {}
If I'm not mistaken, I believe that the expected behaviour would be for
both sequences to be empty right after the remove, so removeAll wouldn't
really have to remove anything.
By the way: I thought about using a Native('java.util.LinkedList') to
work around this issue (it also has more convenient methods, such as
removeFirst and getFirst), but no matter what I do, Epsilon seems to
convert it back to an EolCollection. Is there any way I can avoid that
implicit conversion?
Cheers,
Antonio
|
|
|
Powered by
FUDForum. Page generated in 0.02080 seconds