Browsing 7239 questions and answers with Jon Skeet
Property is parametrized by type, correct (the same with Events)? No, it's not. There's no type parameter on the property itself - you've got it on the class. Compare that with your method example: class GenericList<T> { ... more 2/26/2015 1:29:08 PM
The ValidationException you've thrown will be th in your calling code... there's no cause for that ValidationException. The point of getCause() is for one exception to be able to refer to another one as an underlying cause - but there's... more 2/26/2015 1:20:00 PM
Ok, so: this first code block returns a Task, but it isn't actually returned anywhere. Indeed. You can think of it as being like Task<void> - if that were valid. It's used to indicate when the asynchronous method has... more 2/26/2015 11:27:35 AM
You've created a 9x9 array of BitSet references, but set every element value to the same reference - there's only a single BitSet object involved. This is just a more complex version of this: StringBuilder builder = new... more 2/26/2015 11:24:00 AM
It looks like you're just looking for Stream.flatMap, e.g. long totalTime = list.stream() .flatMap(rangeset -> rangeset.asRanges().stream()) .map(range -> range.upperEndpoint() - range.lowerEndpoint()) .reduce(0, (total,... more 2/26/2015 11:10:45 AM
Two immediate problems with the first two lines: switch(true){ You can't switch on boolean values input = scan.next(); You've got this line immediately within the switch statement - it needs to be within a case statement. I suspect... more 2/26/2015 10:55:45 AM
You just need to call DeserializeObject providing the array type instead of the single class type. Here's a short but complete program demonstrating this... I've adjusted your JSON and class to match each other. using System; using... more 2/26/2015 10:31:10 AM
No, you can't affect type inference that way - and if it did infer TVal as short, your code wouldn't compile, because there's no implicit conversion from int to short. Surely the best solution is just to avoid using two different types to... more 2/26/2015 9:16:14 AM
System.currentTimeMillis() just returns a long - that's not in any sort of date format. If you're actually using: Date date = new Date(System.currentTimeMillis()); System.out.println(date); then you're just seeing the result of... more 2/26/2015 7:05:58 AM
The important point here is that you have a shared variable, and the ++ operator does a read/modify/write operation. That operation is not atomic, even though each individual part of it is. So you could easily have: Thread 1 ... more 2/26/2015 7:00:06 AM