@EinsteinsGrandson HashMap just sorts objects into buckets (in an un-ordered fashion) based on the hashCode() of each key, and it determines uniqueness of objects by calling the equals() method on the key
so if you call map.put(o1, v1); and there already exists an object in the map such that o2.equals(o1), then that call will not insert o1 into the map; instead, it will update the value associated with the o1 key to v1
but it doesn't sort. you'd need to use a SortedMap<K,V> implementation such as TreeMap for that
Do you see anything wrong with the code?
Yes. Why are you adding the three fields together before you compare them?
I would probably do something like this: (assuming the fields are in the order you wish to sort them in)
@Override public int compare(final Report record1, final Report recor...
Very Severe Cyclonic Storm Phailin is a violent tropical cyclone currently threatening the eastern coast of India. Originating from an area of low pressure over the Andaman Sea in early October 2013, Phailin slowly consolidated into a depression on October 8. The depression gained forward momentum and attained gale-force winds on October 9 and was designated as Cyclonic Storm Phailin, becoming the second storm of the season. Phailin is now forecasted to intensify further in the next two days, and make landfall over north Andhra Pradesh and Odisha coasts at peak strength. IMD says that it...
Hurricane David was a Category 5 hurricane on the Saffir-Simpson Hurricane Scale Cape Verde-type hurricane. The fourth named tropical cyclone, second hurricane, and first major hurricane of the 1979 Atlantic hurricane season, traversed through the Leeward Islands, Greater Antilles, and East Coast of the United States during late August and early September. David was the first hurricane to affect the Lesser Antilles since Hurricane Inez in 1966. With winds of 175 mph (280 km/h), David remains the only Category 5 intensity to make landfall on the Dominican Republic in ...
make a new email address, then use a VPN to another country, then make a new account, then use ;) or :) as your smiley, and don't use a name that's recognizably similar to your current display name, and you'll be fine
I have noticed that, as I become better at solving my own problems, I am more reluctant to give up when I hit a problem, and more willing to try 4 or 5 alternate things before I go asking someone else
I have noticed that, as I become better at solving my own problems, I am more reluctant to give up when I hit a problem, and more willing to try 4 or 5 alternate things before I go asking someone else
I have noticed that, as I become better at solving my own problems, I am more reluctant to give up when I hit a problem, and more willing to try 4 or 5 alternate things before I go asking someone else
@EinsteinsGrandson: but if you're constantly asking people for fish, they will slap you with a trout. Learn to fish, and you can sit out in your boat all day with beer.
@EinsteinsGrandson look, when you got a problem you first try to solve it, if it don't work then try again once you run out of ideas, you search for people that had your problem, if still with the problem or somewhere you didn't understood how to solve it then you experiment, if all experiment fails then you ask a question
building up knowledge, or at least knowing where to find the documentation, will help you accrue knowledge, rather than having to ask someone for it all the time
@EinsteinsGrandson You will have to re-explain the problem to every new person. You only have to explain it to yourself once. You can view the big picture and connect dots that might be hidden to others
@EinsteinsGrandson if you aren't using the knowledge you accrue more than once, then you should probably re-consider why you are learning what you are learning... if, on the other hand, you are learning it because someone else told you that you need to learn it, but you don't intend to ever use it again (university class), you should not be taking that class until you understand that you're going to be using it again in the future
@OliverSalzburg No, I think there are people out there who are really this incompetent, and it isn't trolling, it's just that they were raised with this culture of ask someone else to find the answer, instead of thinking
there are millions of people worldwide, probably hundreds of millions, who are in some kind of knowledge worker field, but they actually have no idea how to think
@JourneymanGeek my biggest problem with school is time -- the time it takes to solve assignments -- I value my free time greatly, and I'm perfectly fine with spending 8 hours solving a trivial problem for a hobby project or a work assignment, but I just don't care enough about stupid shit assigned at school to spend that time and expend that energy
I'm kinda like Einsteins that way, I guess, because I want to get it done fast, but I end up doing a half-arsed job because I'm lazy / I don't want to devote the time to do it right
but at least I have the methodology in my brain to do my real career work (hobbyist programming and job) competently
@EinsteinsGrandson The "I only need it this once" argument only applies if you've only ever once visited a stack exchange website. The second time you visit, that argument no longer is valid.
@JourneymanGeek -- that's why I find it tragic, about help vampires, because I know that I used to do that too, and I kinda want to help others become self-sufficient because, on a personal level, someone (or someones) helped me get out of that rut, and I kinda owe society, you know?