Browsing 7239 questions and answers with Jon Skeet
Sure - just iterate over all the directions: private static final String[] DIRECTIONS = {"UP","DOWN","RIGHT","LEFT"}; public static String getDirectionPrefix(String input) { for (String direction : DIRECTIONS) { if... more 1/25/2016 8:30:33 AM
It looks like you're opening the class files within the left hand navigation window. Find the source code instead (the .java files) and open those instead - then everything should be normal. (Look at home05\Solution.java for example,... more 1/25/2016 8:24:15 AM
If your question is basically, "Does unsubscription actually work here?" the answer is C# compiler implementation-specific, theoretically. On a practical basis, the body of the lambda expression doesn't capture any local variables, but... more 1/25/2016 7:15:48 AM
Well, K could be an interface extending Comparable<K> instead of a class implementing it... in which case extends would be more suitable. As the declaration of Entry doesn't know whether K will be an interface type or a class type,... more 1/25/2016 6:48:39 AM
I am really confused how this is possible even after changing the value contained within the key hashCode is same. it's literally breaking the immutable key concept. Nope, it's fine. You're not overriding equals or hashCode, so it's... more 1/24/2016 8:15:27 PM
There are various options here: Expose rules publicly but safely, e.g. via a ReadOnlyCollection<T> wrapper or as an IEnumerable<IRule> via return rules.Select(r => r); to avoid the actual list being exposed via casting.... more 1/22/2016 7:53:15 AM
Yup, the enhanced for statement just doesn't work like that. It always declares a new variable. You can use: for (String tmp : isoCountryCodes) { mCountryCode = tmp; ... } ... although frankly that's a pretty odd thing to do.... more 1/21/2016 7:05:04 PM
You effectively need a method with a signature of public static ICollection<TEntity> MapToCollection<TEntity, TEntityDto>( this ICollection<TEntityDto> dtos) where TEntityDto : IEntityDto ... but that would... more 1/21/2016 5:45:35 PM
But , when I do not consider storing " input.nextLine()" in a String , it begins to skip line alternatively . Is it , that , it is taking even the ENTER from keyboard as input ? Well no, it's just reading the next line every time you... more 1/21/2016 3:49:12 PM
You could use dynamic typing here: // I don't recommend you do this - see later public void TakeTwo(dynamic value1, dynamic value2) { baseAPI.GetValues(value1, value2); } The overload resolution for the call to GetValues will then... more 1/21/2016 7:03:51 AM