Empty directory: Difference between revisions
Content deleted Content added
+Java 7 |
m →{{header|Java}}: before anyone asks |
||
Line 5:
=={{header|Java}}==
{{works with|Java|7+}}
This method does not check that the path given is actually a directory. If a path to a normal file is given, it will throw a <code>NullPointerException</code>. <code>File.listLess()</code> does not count the "." and ".." entries.
<lang java5>import java.nio.file.Paths;
//... other class code here
Line 11:
return Paths.get(dirName).toFile().listFiles().length == 0;
}</lang>
=={{header|Ruby}}==
{{works with|Ruby|1.8.7}}
|