Browsing 7239 questions and answers with Jon Skeet
Well you could refactor that particular code to: logUpdate(update, activity.getName(), name, "name", id); activity.setName(name); logUpdate(update, activity.getPlannedDuration(), plannedDuration, "planned duration",... more 10/1/2013 6:08:53 AM
This line: Date date1 = new Date(2013, 10, 1, 11, 6); ... doesn't do what you thing it does. That creates a Date object representing November 1st in the year 3913, at 11:06 local time. I don't think that's what you wanted. Indeed, if... more 10/1/2013 5:46:40 AM
The error message says it all - the DriverId field in each row is an int, not a List<int>. Ditto for DriverName being a string, not a List<string>. You should change your DriverId and DriverName properties to be int and string... more 9/30/2013 9:35:36 PM
Can the reader-thread see the result of changing the value of the variable in the other thread if this variable is NOT volatile? It may be able to, yes. It's just that it won't definitely see the change. In general, as I... more 9/30/2013 9:26:58 PM
Your current code assumes the value is in seconds - whereas it looks like it's in milliseconds since the Unix epoch. So you want: private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, ... more 9/30/2013 8:34:05 PM
I am confused because I thought that once the object was submitted to another data structure, it has an independent entity and no operations can be taken on it unless I access this data structure containing it. No. The map contains a... more 9/30/2013 8:15:11 PM
Firstly, I strongly suspect that this isn't going to be a performance bottleneck. As ever, test the simplest code that works before you use more complicated code. You could use AtomicInteger instead of Integer as the value type of your... more 9/30/2013 7:01:48 PM
It's not clear from your question, but I suspect that this: rewardServicesImpl.getAccountRewardSummary(request); should be: result = rewardServicesImpl.getAccountRewardSummary(request); If you want to use the value returned from a... more 9/30/2013 6:48:00 PM
Firstly, make all the business logic deal just with time-related types. (Personally I'd use my Noda Time library with its LocalTime type for this work, but...) The parsing can come in the calling code. The logic is reasonably simple: if... more 9/30/2013 6:42:14 PM
I suspect you just want to remove the second line. What's it doing there anyway? You're fetching the value of the property from the object referred to by businessObject - and setting that to the new value of businessObject. So if this... more 9/30/2013 6:32:34 PM