Browsing 7239 questions and answers with Jon Skeet
My problem, as you may have noticed, is that firstly, the time is wrong. It's added an hour. No it hasn't. Not really. It's displaying the exact same time, but in your local time zone. Unfortunately you can't easily determine the... more 2/10/2014 7:07:54 PM
Your list isn't sorted to start with. Binary search only works when the original input is sorted. The whole point is that you know that if list[x] = y, then list[a] <= y for all a < x and list[a] >= y for all a > x. So either... more 2/10/2014 5:46:50 PM
Without knowing the platform default encoding of your machine, it's slightly hard to say - and you should avoid calling String.getBytes without specifying an encoding, IMO. However, basically a String represents a sequence of characters,... more 2/10/2014 4:13:21 PM
Yes, it's behaving exactly as documented. As per the cancel() documentation: Once a timer has been terminated, its execution thread terminates gracefully, and no more tasks may be scheduled on it. And as per the documentation of the... more 2/10/2014 4:08:12 PM
It's just the - operator, applied to the result of calling Convert.ToSingle(...). So for example when used as a unary operator: double x = 10.52123; float y = -Convert.ToSingle(x); is equivalent to: double x = 10.52123; float tmp =... more 2/10/2014 2:06:23 PM
You're already making an incorrect assumption: that the value returned will be the lowest index. From the documentation: If the list contains multiple elements equal to the specified object, there is no guarantee which one will be... more 2/10/2014 12:17:25 PM
csc will always write the output into the current working directory unless you specify a different output location with the /out flag. So it won't work if you don't have write access to the current working directory, unless you specify... more 2/10/2014 11:21:32 AM
This is the problem: calendarStart.set(Calendar.YEAR,calendarStart.YEAR); You're setting the value to Calendar.YEAR which is a constant with value 1. If you don't want to change the year number, just remove this line completely. (As... more 2/10/2014 10:51:26 AM
What is the benefit of having both of these? It was a poor design choice, IMO. It would have been cleaner to avoid Thread implementing Runnable in the first place. This has led to various bugs (as witnessed by questions on Stack... more 2/10/2014 9:57:56 AM
Just check for null first, just as you would if you were writing normal C# code in a loop. where p.destinataire != null && p.destinataire.StartsWith("D") If p itself can be null (i.e. your list can contain null elements) then... more 2/10/2014 9:52:46 AM