Browsing 7239 questions and answers with Jon Skeet
The reason it's working for you is not because of the way CheckAsync is called, but because you're awaiting the result of Task.Delay. That will always return a "not completed yet" task, so awaiting it will schedule a continuation. That... more 8/24/2014 8:07:34 AM
I suspect you want flatMap instead of map, and then use Collectors.toCollection to create the sorted set: final SortedSet<String> fields = files .stream() .parallel() .flatMap(x -> getFields(x).stream()) ... more 8/22/2014 11:17:42 PM
You're expected to give a time zone ID - not the abbreviation for "half" a time zone. So for example, America/New_York is one example of a time zone ID for Eastern Time (there are others, for time zones which may be like New York now, but... more 8/22/2014 7:14:51 PM
You're using Task.WaitAll - that blocks until all the tasks have completed. Instead, you should use Task.WhenAll, which returns a Task which will itself complete when all the other tasks have completed. You can then await that. await... more 8/22/2014 4:45:05 PM
Note: since writing this answer, I've become aware of issues creating multiple Random instances, even though it sounds like it should work. I've generally found that a better alternative is to have a single Random instance and just lock on... more 8/22/2014 1:25:59 PM
In modern Java, neither of these is needed. The reason for using Class.forName in "the good old days" was that it would run the type initialization code, which would register the driver with JDBC. You don't need to create a new instance... more 8/22/2014 9:33:22 AM
There are several issues here: Dictionaries aren't ordered - so the order in which the cards come out of OrderBy may not be reflected when you iterate over the dictionary later. I believe in the current implementation it may happen to do... more 8/22/2014 9:18:51 AM
There are three problems with your current code: "CEST" isn't a time zone Java recognized. Try Europe/Paris instead, as a European time zone java.util.Calendar uses 0-based months (yes, it's awful) You haven't cleared out the time part... more 8/22/2014 8:53:51 AM
Shouldn't 3 be stored in the variable c? No, the integer representation of '3' should be stored in the variable c, and indeed is. You're effectively doing: char tmp = a[a.Length - 1]; // tmp = '3' int c = tmp; // Implicit conversion... more 8/22/2014 8:35:55 AM
I think you're just looking for the overload which takes another Collector to specify what to do with each group... and then Collectors.counting() to do the counting: import java.util.*; import java.util.stream.*; class Test { public... more 8/22/2014 6:55:51 AM