Browsing 7239 questions and answers with Jon Skeet
You're trying to use java.nio.file.Files.readAllLines(Path), which was introduced in Java 8. You're not going to be able to use that in Java 7. Options: Upgrade to Java 8 on the raspberry pi Don't use any classes/methods which are... more 5/30/2014 2:59:53 PM
As you say, you've got to perform type checking of some description. However, you can easily break it down into smaller methods and even have an open registration scheme: private readonly Dictionary<Type, Delegate> obfuscators = ... more 5/30/2014 2:37:36 PM
It sounds like you want something like: var doc = XDocument.Load(path); var lastFile = doc.Descendants("File").LastOrDefault(); if (lastFile != null) { lastFile.Remove(); } // Now save doc or whatever you want to do with it... more 5/30/2014 2:20:42 PM
No, there's nothing like that in Java. The closest you've got is putting classes within the same package, at which point they have access to any members which don't specify any access modifier. You can't specify particular classes... more 5/30/2014 12:45:28 PM
You can fetch the value when you check for containment. In fact, in this case you can make it unconditional: int value; stats.TryGetValue(eventName, out value); stats[eventName] = value + eventValue; This uses the fact that value will... more 5/30/2014 10:24:30 AM
There are a few very subtle differences in some cases - for example, if the original Task returns with a status of Faulted but with an OperationCanceledException then the async version would return a task with a status of Canceled... but... more 5/30/2014 8:58:40 AM
I have a byte array which "contains" text - the encoding/charset is unkown at this time. If you don't know the encoding, then there is simply no concept of whitespace, \r, \n characters etc. Those characters could map to any... more 5/30/2014 7:51:21 AM
You could do this with events and a custom delegate type, where the delegate type documentation can indicate the old value and new value parts. For example: // As we want a non-void return type, we're not following the event... more 5/30/2014 7:15:28 AM
The problem is that you're adding seconds after converting to local time. In other words, you're converting the Unix epoch to EST, then adding 1401395106 seconds. Insteead, you should be adding 1401395106 seconds to the Unix epoch, and... more 5/29/2014 8:45:17 PM
No, the null itself doesn't carry the type information. The cast just tells the compiler what the type of the variables a and b should be... it can't tell without the cast, because null is convertible to any reference type or nullable... more 5/29/2014 8:39:28 PM