Last active
February 19, 2016 19:11
-
-
Save twolfe18/f639ed6d3b5dccf73558 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File f = new File("foo.txt"); | |
// You're not allowed to make a Path using raw strings, | |
// that would be dangerous! | |
Path p = FileSystems.getDefault().getPath("foo.txt"); | |
// Both of these type check :) | |
f.getName().endsWith(".txt"); // true | |
p.getFileName().endsWith(".txt"); // false |
Also, though this is one example and the sentiment is general, try stepping through various java.util.Stream
methods trying to find a bug sometime. I don't know why they tried to go so functional, including things like File.isDirectory
is a method while Files.isDirectory
is a function. Should have added java.util.function.*
, closures, and stopped there. If I wanted to write functional programs, I wouldn't be using Java!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Path
should not have the methodboolean endsWith(String)