Rectangle 27 0

How to check the extension of a Java 7 Path?


path.toString().toLowerCase().endsWith(".java");

The Path class does not have a notion of "extension", probably because the file system itself does not have it. Which is why you need to check its String representation and see if it ends with the four five character string .java. Note that you need a different comparison than simple endsWith if you want to cover mixed case, such as ".JAVA" and ".Java":

Note
Rectangle 27 0

How to check the extension of a Java 7 Path?


path.toString().toLowerCase().endsWith(".java");

The Path class does not have a notion of "extension", probably because the file system itself does not have it. Which is why you need to check its String representation and see if it ends with the four character string .java. Note that you need a different comparison than simple endsWith if you want to cover mixed case, such as ".JAVA" and ".Java":

Note
Rectangle 27 0

How to check the extension of a Java 7 Path?


path.toString().toLowerCase().endsWith(".java");

The Path class does not have a notion of "extension", probably because the file system itself does not have it. Which is why you need to check its String representation and see if it ends with the four five character string .java. Note that you need a different comparison than simple endsWith if you want to cover mixed case, such as ".JAVA" and ".Java":

Note