|
Jam2 posted:Harvard CTO, Jim Waldo is coming in to speak to my intro java class tomorrow. He was on the team that developed the Java programming language at Sun back in the day. "What on god's green earth were you guys thinking when you wrote the Calendar class?"
|
# ¿ Jul 19, 2011 04:13 |
|
|
# ¿ Apr 26, 2024 09:27 |
|
MEAT TREAT posted:Just show them how to convert everything into a Runtime exception . Why bother when you can just add throws Exception everywhere?
|
# ¿ Jul 26, 2011 22:39 |
|
pliable posted:Pffffffft, amateur. Yeah, that's definitely tripped me up a few times, but once you learn...it's so valuable. Always use equals() to compare everything but primitive types
|
# ¿ Oct 30, 2011 01:29 |
|
hootimus posted:Another stupid Java question: You should just be able to add external JARs to your project. Right-click on your project and I think it's under "Source" there should be an option to add an external JAR.
|
# ¿ Nov 26, 2011 22:29 |
|
Mobius posted:It's also usually (always?) possible to do the same thing with a while or for loop. Always. You can trivially transform any do/while into a simple while. code:
code:
|
# ¿ Mar 3, 2012 00:35 |
|
Jabor posted:I think you mean: Yes, this is what I meant
|
# ¿ Mar 3, 2012 03:25 |
|
fletcher posted:
Is it always "value XX"? If so, consider just using a list of Integers and transforming the output elsewhere. Then the sort will work fine. Otherwise, you'll have to write a custom comparator to pass into Collections.sort or just write your own sort (which would be kind of silly).
|
# ¿ Mar 8, 2012 00:00 |
|
Brain Candy posted:Use JodaTime. This should be in the OP, if not be the entirety of the OP.
|
# ¿ Feb 17, 2014 19:38 |
|
Internet Janitor posted:Computers are fast, man. Don't worry about the overhead of compressing and decompressing a 1mb file at compile time until you try it and it's actually a bottleneck. Premature optimization something something
|
# ¿ Nov 13, 2014 17:45 |
|
|
# ¿ Apr 26, 2024 09:27 |
|
baka kaba posted:I did it on Android because my memory use was creeping up on a draw list in a render loop! Just saying that there are sometimes situations where you might care about these things, but in general don't bother and go with the nice easy readable version Yes but don't confuse "more performant in some scenarios" with "cleaner". The foreach style loop is pretty much objectively "cleaner" from a code standpoint.
|
# ¿ Oct 26, 2015 20:28 |