Browsing 7239 questions and answers with Jon Skeet
There are two problems here: You're using Function, which has to return something. setBar doesn't return anything. Function only takes a single input, but you've got two inputs: the Foo you'd call setBar on, and the String argument you'd... more 5/21/2014 9:38:59 PM
Let's simplify the code a little so it's easier to read: foo.setX(foo.getX() + foo.getY()); foo.setY(foo.getX() + foo.getY()); Now suppose we start with foo.X = 10, foo.Y = 20. The first statement will initially compute foo.X + foo.Y -... more 5/21/2014 7:59:32 PM
All your properties are static - that means that they are related to the type rather than any one instance of the type. (It's not that the values are "shared by all instance" - it's that they're completely unrelated to any instance.) You... more 5/21/2014 7:51:18 PM
It sounds like you're just missing the fact that indexer syntax in C# is [key]. I suspect you want: if (TypeDescriptor.GetProperties(this)[propertyName] == null) That's first calling the GetProperties method, to find the... more 5/21/2014 7:45:19 PM
You can use String.format to control the format in general. Unfortunately I can't see any way of combining that with a custom pattern directly, but you can compose them. For example: import java.math.*; import java.text.*; public class... more 5/21/2014 7:26:32 PM
getParent() returns a String - you can't call getParent() on a String. Instead, you want getParentFile(): File grandparent = file.getParentFile().getParentFile(); more 5/21/2014 6:32:48 PM
I suspect the problem is that you want the mock object, not the wrapper: var service = new EmployeeService(mockScoreRep.Object); In other words, you want to pass an IRepository<Score> - not a... more 5/21/2014 5:43:38 PM
I think it may just be a case of changing this: Class activityItems = Class.forName("com.arbaz.hk." + item); to: Class<?> activityItems = Class.forName("com.arbaz.hk." + item); That way you're still not saying you know what the... more 5/21/2014 5:41:20 PM
No, basically zzz will always use the system default time zone. From the documentation: With DateTime values, the "zzz" custom format specifier represents the signed offset of the local operating system's time zone from UTC, measured... more 5/21/2014 5:17:05 PM
Look at this code: if (compInt1 < compInt2) { return -1; } else if (compInt1 >= compInt2) { return 1; } else { return 0; } How do you expect that ever to return 0? What values of compInt1 and compInt2 would make both... more 5/21/2014 4:16:33 PM