Browsing 7239 questions and answers with Jon Skeet
You're assuming that just because view.get() returns a non-null value the first time, it will return a non-null value the second time. It may not - the target could be removed between the two calls. You could eliminate this with: if (view... more 10/17/2013 9:45:06 AM
The problem is that within new ArrayList<Entry>() { ... }, this is an ArrayList<Entry>. The clue is in the error message, which specifies which constructor signature it's looking for. If you really want to use this sort of... more 10/17/2013 9:23:09 AM
You want the Microsoft.Bcl.Async package. That's a properly released, non-CTP package that is stable. This also requires VS2012 since an updated compiler is needed to understand async and await. In theory one could use older tools from... more 10/17/2013 8:41:00 AM
You'd need to use MulticastDelegate.GetInvocationList and invoke each delegate separately. For example: List<int> results = numberGenerator.GetInvocationList() .Cast<IntegerGenerator>() ... more 10/17/2013 8:31:00 AM
Hyperthreading effectively gives you more cores, for integer operations - it allows two sets of integer operations to run in parallel on a single physical core. It doesn't help floating point operations as far as I'm aware, but presumably... more 10/17/2013 6:57:03 AM
Simply put - it takes quite a while to display 20 million lines of text. It's easy enough to show that. Run this code: for (int x = 0; x < 20767725; x++) { System.out.println(x); } I suspect that'll take about 5 minutes as well. more 10/17/2013 6:53:21 AM
This is the problem: String nameToWrite = fn; ... outStream.write(nameToWrite.getBytes()); fn will only have a non-null value after actionPerformed has been called at least once. So when you call the constructor, fn is null, so... more 10/16/2013 8:37:26 PM
It sounds like you're going to want to have in memory (for display in textboxes) everything that the user selects - so that's a natural boundary for what's feasible anyway. I suggest the following approach: Read all of the matching... more 10/16/2013 8:31:44 PM
my question is that why b*b promote to int Because that's what the language specification says it will do. and why [...] this line got 0 why not promote to that double Again, because that's not how the language is... more 10/16/2013 7:58:24 PM
No - there's no guarantee that each call will return a different value. It's not inconceivable that the call (including synchronization) could take less time than the granularity of the internal clock used for nanoTime(). (Indeed, I can... more 10/16/2013 7:05:07 PM