
On Thursday, May 29, 2014 09:30:31 AM Daniel Erez wrote:
----- Original Message -----
From: "Alexander Wels" <awels@redhat.com> To: devel@ovirt.org Sent: Thursday, May 29, 2014 4:05:13 PM Subject: [ovirt-devel] SortedListModel
Hi guys,
I have a question about the SortedListModel. If you look at the setItems(Collection<T> value) method. You will notice that eventually all the items are added to a SortedSet. This is not a problem if all the elements of your collection are different. But what happens if the elements of your collection are not all different. More specifically if I pass in a comparator that matches on a field of the object that is not different like description, or size or something of that nature.
The set will reduce the number of elements. Before I change it to be a list that can have duplicates, I would like to know the origin of the set and if there are going to be any issues when I do that.
afaik, SortedListModel only maintains a list of business entities, hence there isn't an issue with duplicate objects (as all displayed entities are unique). Are you trying to make use of SortedListModel with a list of strings or something similar?
Well the new sorting infrastructure uses sorted list model with a Comparator. The Comparator can compare basically any field in the entities. For instance description. There is nothing stopping descriptions from being the same between different entities. Now if I use the SortedSet with the Comparator on description and I have entities with the same description, entities are disappearing from the result.
Thanks, Alexander _______________________________________________ Devel mailing list Devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/devel