Browsing 7239 questions and answers with Jon Skeet
From the Mozilla documentation: If parseInt encounters a character that is not a numeral in the specified radix, it ignores it and all succeeding characters and returns the integer value parsed up to that point. parseInt truncates... more 4/30/2015 12:21:48 PM
RegimeItems is a collection of RegimeItem elements - it's not a single element, so it doesn't have a single ID. It sounds like you may want something like: return db.Users .Where(r => r.RegimeItems.Any(ri =>... more 4/30/2015 11:00:17 AM
It sounds like you want a producer/consumer queue. You can rig that up fairly easily using BlockingCollection<T>. Create the blocking collection Start a task which will read from the collection until it's "finished" (simplest with... more 4/30/2015 8:40:37 AM
Now, on creating a new instance of class B, which constructor of class A is automatically called before invoking the class B constructor? The code will fail to compile, basically. Each constructor has to chain to another constructor,... more 4/30/2015 5:45:06 AM
Well, you could use delegates, and return a Func<double>: Func<double> GetExpression(int x, int y, int z) { return () => x * y + z; } var expression = GetExpression(1,2,3); double result = expression(); // Or... more 4/29/2015 8:52:53 PM
Well, firstly I would strongly recommend that you don't do this. Having multiple names for the same value is a really bad idea, IMO. However, you can do it with reflection: using System; using System.Collections.Generic; using... more 4/29/2015 5:51:04 AM
Three options: You could create a nested class within the same class you want to use this code; no need for a new file public static void doSomething() { foo(Baz.class); } private static class Baz extends Bar { // Override a... more 4/29/2015 5:42:52 AM
Can I just create the program directly the way I do it in other languages? No. I mean is the concept of class necessary in Java? Yes. Every method, field etc is always in a class (or interface). Yes, that's an overhead for tiny... more 4/28/2015 6:50:26 PM
Your input is effectively a LocalDateTime. It would be much simpler to simply parse that to a LocalDateTime and then get the LocalTime from that. No time zones to worry about, no somewhat-legacy classes (avoid Date and Calendar where... more 4/28/2015 6:49:24 PM
I would say yes that it is guaranteed, because i is a local variable, and each thread has its own stack so i will be a different memory location for each thread. Exactly. Each call to foo will be independent, because foo isn't using... more 4/28/2015 4:20:31 PM