1. Introduction
The list() method returns an array of pathnames strings that satisfy the specified filter. This method works simillar to list() method, except that returned array must satisfy the filter.
2. Method signature
Parameters:
- FilenameFilter filter - a filename filter
Returns
- String
[]
- array of the pathnames
Throws
- SecurityException - when we do not have access to the file or directory
3. Examples
3.1. Code snippet that returns the pathnames of .txt
files from /tmp/ttt
directory
The output:
4. Conclusion
In this article, we presented list(FilenameFilter filter) method that works similar to a simple list() but gives the ability to filter the resulted array.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}