Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • null check pls public int compareTo(PostalCodes other) { return other==null ? 1 : city.compareTo(other.getLocation()); } Commented Apr 2, 2014 at 3:31
  • Technically correct on the null check, but that's implementation specific - if city is guaranteed to be never null, then there's no need. That, and having no null check here early on highlights places in which that assumption may be invalid. Commented Apr 2, 2014 at 3:32
  • Awesome Makoto I appreciate it Commented Apr 2, 2014 at 3:32
  • null check on other Commented Apr 2, 2014 at 3:32
  • @Makoto I did what you said, but when I tried to sort the array I got the error I showed above in my main post. I also posted my main part of my program on my edited post. Commented Apr 2, 2014 at 3:45