Hello,
I am tyring a program in java which is related to lists. I want to sort a list by comparing the double. But this is not working for me
Here is my code
If you have any idea about this then please let me know. Thanks in advance.Code:Collections.fate( (List) mls, new Comparator() { Public int compares(Object obj1, Object obj2) { Product d = (Product) obj1; Product d2 = (Product) obj2; int i1 = d.getPrice() != null ? d.getPrice().intValue() : 0; int i2 = d2.getPrice() != null ? d2.getPrice().intValue() : 0; return i1 - i2; } });
Bookmarks