Browsing 7239 questions and answers with Jon Skeet
Do any of you know the meaning if this keyword? Yes. It's not valid C#, but in IL it's the equivalent of finally, but only if an exception has been thrown. There's no direct correlation in C#, which is why the decompiler can't... more 2/27/2014 10:08:08 AM
The problem is your BinarySearchTree declaration. It's implementing the raw Iterable type, when it should be implementing Iterable<AnyType>. With the raw Iterator type, the code using the enhanced-for loop only knows that the values... more 2/27/2014 7:24:59 AM
You can't, just from an exception you don't control. There's no indication in the exception what instance happened to have a method executing when the exception was generated. I would suggest using a debugger (so that you can break if... more 2/26/2014 9:29:14 PM
Use Noda Time :) That doesn't relieve you from the burden of thinking how you want to handle this - but it allows you to specify how you want to handle it. Fundamentally, you've been given a value that doesn't exist... so you can choose... more 2/26/2014 8:32:37 PM
It's not entirely clear what you're asking, but if all you want is to make your DateFormat use UTC, that's easy: public static DateFormat getFormat() { String systemLocale = System.getProperty("user.language"); //$NON-NLS-1$ ... more 2/26/2014 8:25:05 PM
What's the problem? You've put the same value in the "outer" map for both entries: a reference to the single Map<Integer, Double> you've created. When you call put, it just adds the reference to the map - it doesn't take a deep... more 2/26/2014 7:24:25 PM
Yes, it's quite right. Look at the documentation for InputStreamReader and you won't find a constructor taking a File parameter. Instead, you should construct a FileInputStream to read from the file, and pass that to the constructor of... more 2/26/2014 1:04:41 PM
You're asking whether the type is final, not the parameter - and java.util.Date isn't a final class. Looking at the API, I can't immediately see any way of determining that a parameter is final - but that's really an implementation detail... more 2/26/2014 12:52:27 PM
If " is a special character, shouldn't the second line be marked as incorrect? No, because the rules of the language don't require " to be escaped within a character literal, only within a string literal. It's consistent to allow it... more 2/26/2014 11:09:32 AM
If it's sorted, you can use Array.BinarySearch which will be O(log n) instead of O(n): int index = Array.BinarySearch(sortedArray, targetValue); if (index >= 0) { // Found! } (BinarySearch returns a negative number if the value... more 2/26/2014 10:42:00 AM