[Vala] [LigGee] remove_all behavior at removing same items



Hi,

In what way should remove_all work in case of removing the same items.
Currently there is an inconsistency in this behavior from remove_all
on AbstractCollection and the implementation in ArrayList.
The AbstractCollection implementation will call remove for every
element which will in case of n same items in list 1 and m same items
in incoming list 2 remove n-m items.

For example:
list1 has items 1,1,1,1,1 and list2 has items 1,1,1
after remove_all in list1 would remain items 1,1

The implementation on ArrayList will always remove all items from the
list if the incoming list has such an item.
So in the same example as above list1 after the call would not have any items.

I have looked also how Java's ArrayList behaves in such a case and it
did behave in a different way as above. The Java's ArrayList treated
the incomming collection as a set and did delete only one element from
the list1.
So the example would look like this:
list1 has items 1,1,1,1,1 and list2 has items 1,1,1
after remove_all in list1 would remain items 1,1,1,1

Which of this behavior would you prefer?

regards, Tomaž



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]