Check out example codes for "how to get all the names of the files in a folder in java?". It will help you in understanding the concepts better.

Code Example 1

List<String> results = new ArrayList<String>();

File[] files = new File("/path/to/the/directory").listFiles();
//If this pathname does not denote a directory, then listFiles() returns null. 

for (File file : files) {
    if (file.isFile()) {

Learn ReactJs, React Native from