Re: Logical inconsistence between Set and SortedSet interfaces

2013-01-27 Thread Peter Levart
You can also create your own java.util.Comparator implementation that never returns 0 for two "different" keys. In your example, you would have to break the ties by 1st comparing the desired attribute(s) that you want to order by and then some unique attribute - you might want to add it to the

Logical inconsistence between Set and SortedSet interfaces

2013-01-27 Thread Andrej Hollmann
Hello, I want to add few products to the SortedSet and sort them by price. I add four different elements to TreeSet: ["salt",0.5$], ["milk", 1$], ["bread", 1$], ["bananas", 2$] But at the end my TreeSet contains only three elements: ["salt",0.5$], ["bread", 1$], ["bananas", 2$] The "bread" re