i am using collections.sort methods int compare to compare 2 objects distance parameter and sort them according to distance in ascending order. here is what i am doing to compare it
Collections.sort(venuesList, new Comparator<FoursquareVenue>() {
@Override
public int compare(FoursquareVenue lhs, FoursquareVenue rhs) {
return lhs.getDistance().compareTo(rhs.getDistance());
}
});
I think there is just some small silly thing i am missing to do but i couldn't figure it out whats the problem error says something like this
07-12 14:52:51.018: E/AndroidRuntime(1377): FATAL EXCEPTION: main
07-12 14:52:51.018: E/AndroidRuntime(1377): java.lang.NullPointerException:println needs a message
07-12 14:52:51.018: E/AndroidRuntime(1377): at android.util.Log.println_native(Native Method)
07-12 14:52:51.018: E/AndroidRuntime(1377): atandroid.util.Log.v(Log.java:117)
I think i need to handle the null values of the object but i don't know how can i do that?