Browsing 7239 questions and answers with Jon Skeet
Look at the line of code before your call to populatePartialList: _list = new RestaurentList(); You've created a new instance of RestaurentList. That will have called populateList(), but not waited for it complete. Assuming your real... more 10/6/2014 9:27:05 AM
A LongAdder array will only contain references anyway, so that's what will be copied. The fields within LongAdder are irrelevant to that. Whether it's "safe" to use arraycopy depends on what you're doing with it - if you're using that to... more 10/6/2014 9:15:40 AM
Looking at the class file format, I don't believe that information is stored anywhere - so the answer would be "no". If you're building your classes into a jar file, you might want to include a metadata file which specifies this... more 10/6/2014 9:12:31 AM
I'm not an XPath expert, but I suspect your query now is trying to find jobs where the name element is equal to a receiverjob element. I suspect you want something like this: "descendant::d:job[name/text()='receiverjob']" It's also... more 10/6/2014 8:23:31 AM
This is the problem: java -cp src -jar FooJar.jar From the java tool documentation: When you use the -jar option, the specified JAR file is the source of all user classes, and other class path settings are ignored. Try running it... more 10/6/2014 7:17:08 AM
You just need to use BindingFlags.DeclaredOnly: Specifies that only members declared at the level of the supplied type's hierarchy should be considered. Inherited members are not considered. For example, assuming you want private... more 10/5/2014 8:08:16 PM
You can't remove an element from an existing array - once you have created an array, its length is fixed. You can replace elements, but you can't add or remove them. Options: Change the value of the variable to refer to a new list,... more 10/5/2014 7:48:01 PM
It sounds like you want: var authorize = user.RolesList.Exists(r => allowedRoles.Contains(r.Name)); Or transform the list of roles into their names, and see whether that intersects with the allowed roles: var authorize =... more 10/5/2014 4:04:16 PM
Well the simplest option is to use else if so you only need to check one condition anyway - which means it would handle 33 as well (currently not handled): if (rand < 33) { Console.WriteLine("rand was in the range [0, 32]"); } else... more 10/5/2014 3:59:21 PM
Unless you have code to specifically remember the difference between a property which has been initialized with its default value, and one which hasn't been set at all, you can't tell the difference. I have two suggestions, however: You... more 10/5/2014 3:56:17 PM