Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Different behavior in remove and removeAll?
Different behavior in remove and removeAll? [message #574362] Tue, 18 August 2009 14:05
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 304
Registered: January 2010
Senior Member
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
Previous Topic:"Resource not found" when epsilon.emf.register and permanently=true
Next Topic:"Resource not found" when epsilon.emf.register and permanently=true
Goto Forum:
  


Current Time: Thu Jul 24 16:19:42 EDT 2014

Powered by FUDForum. Page generated in 0.03934 seconds