Issues with handling files
So what I want to do is for each file in a directory use it to create an object and store that object into a collection of some sort. I also need each object to remember its original name, but that's easy enough. Here's the first little bit fun main(args: Array<String>){ val dir = File(args.joinToString()) Now I've tried 2 routes. dir.walk().forEach or files=dir.listFiles() I think either of these would work, but my bigger problem is that I can't store them anywhere. Id like each File to be it's own variable but the number of files is variable and I'm pretty sure kotlin doesn't support dynamically named variables. And I'm having trouble using an array or map because I need to initialize it but I'm not sure how. Short version. I need help taking n files from a directory, applying each to a class constructor, and then store those objects in some n element long collection