Browsing 7239 questions and answers with Jon Skeet
So my question is why does the fist code segment with futures and callable response is always sequential? Because you're specifically asking for the result of the Futures in the order in which they were submitted: for... more 2/4/2015 3:16:34 PM
UUID.nameUUIDFromBytes appears to basically just be MD5 hashing, with the result being represented as a UUID. It feels clearer to me to use a base64-encoded hash explicitly, partly as you can then control which hash gets used - which... more 2/4/2015 2:42:21 PM
Your first join doesn't use c at all. This: join c in db.AY_COMPANIES on cbr.COMPANY_ID equals ID should almost certainly be join c in db.AY_COMPANIES on cbr.COMPANY_ID equals c.ID (or whatever the ID should map to within... more 2/4/2015 1:38:18 PM
How about: Optional<String> ostr = ppo == null || ppo.isEmpty() ? Optional.empty() : Optional.of(ppo); You can put that in a utility method if you need it often, of course. I see no benefit in creating an Optional with an... more 2/4/2015 1:22:22 PM
I'm curious if is possible to get event name in event handler? No, it's not. The event handler is just a method. It could be invoked directly, not in the context of any event. What you could do is have: public Mother() { Boy son... more 2/4/2015 11:57:15 AM
It sounds like you need a combination of Join and Select: String.Join("", _ l.Select(Function(s as String) String.Format("<li>{0}</li>", s)) Of course, you could always write your own JoinFormat extension method - that... more 2/4/2015 11:32:45 AM
but the output of above parsed date is still in 24 hours format instead of 12 hours AM/PM. You've parsed the value using hh, but the output is just what you get from calling Date.toString(): Converts this Date object to a String... more 2/4/2015 10:12:17 AM
You could use plain LINQ to do this: var repeated = Enumerable.Repeat(original, 3) .SelectMany(x => x); Or you could just write an extension method: public static IEnumerable<T> Repeat<T>(this... more 2/4/2015 8:25:33 AM
it is initialize with 10 elements No, it isn't. It's initialized with an internal buffer size of 10, but that's largely an implementation detail. The size of the list is still 0, as you can confirm by printing out list.size() before... more 2/4/2015 7:04:21 AM
You can do this: string s = ""; int ia = 0; int ib = 5; s = (ia = ib).ToString(); I wouldn't recommend it, but it will work - ia will be 5, and s will be "5". Would you really rather do that than use two statements though? I try to... more 2/4/2015 7:01:10 AM