Here is a method that shows you how you can read some files in a directory and then use a good data structure called HashMap. This HashMap contains the file name as the key, and the contents of the specified file as the value. This is done with Java 8, and therefore you must have the specifications specified in accordance with these specifications. Other than this, you only need to create a few files in the root directory of the project, and then run this code. After completing the above code, you are shown the result for testing.
I have a good day, and I hope that you can adapt this code to your needs ... otherwise ... not using the main method, and instead calling it when you start the application ... and then using the HashMap links from within your user-defined interface you can fill in your lists.
package filereader; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; public class FileReader { public static void main(String[] args) { try {
}
source share