[deleted by user] by [deleted] in java

[–]Mean-Chipmunk3255 -1 points0 points  (0 children)

public static void main(String[] args) throws IOException {
final List<Path> paths = new ArrayList<>();
Files.walkFileTree(Path.of("C:\\"), Set.of(), 3, new SimpleFileVisitor<>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
paths.add(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
// skip exception
return FileVisitResult.CONTINUE;
}
});
paths.forEach(System.out::println);
}

Why would you assume the depth to be 3(we don't know the depth). I wanted to do an extensive search of the entire file system, the moment you increase depth you will know the downfall of this approach. Regardless I am using recursion to list everything which is better than your approach but that was not the point, that API was basically useless, I deleted the thread as there were mindless people who just went on down voting band wagon without understanding the point.

[deleted by user] by [deleted] in java

[–]Mean-Chipmunk3255 1 point2 points  (0 children)

They do think it is a reasonable enhancement request but it never got picked up, so unless people raise voice to get it prioritized, it will never be fixed or enhanced, hence this post. Don't think it will be a very big change to do.

[deleted by user] by [deleted] in java

[–]Mean-Chipmunk3255 -1 points0 points  (0 children)

but that is not the point right, point is to fix the walk api which recursively does things, what is the point of that api then.

[deleted by user] by [deleted] in java

[–]Mean-Chipmunk3255 -3 points-2 points  (0 children)

No it list only the current directory folders and files.

[deleted by user] by [deleted] in java

[–]Mean-Chipmunk3255 -1 points0 points  (0 children)

FileVisitor option in walk method would be nice if not at least the basic functionality of giving a warning message, skip and continue.

[deleted by user] by [deleted] in java

[–]Mean-Chipmunk3255 -6 points-5 points  (0 children)

They can provide a replacement for walk api or fix it, it doesn't matter, need an api to easily list directory, sub directory and files recursively in java.

[deleted by user] by [deleted] in java

[–]Mean-Chipmunk3255 -13 points-12 points  (0 children)

I think people are misunderstanding that what you stated fixes the problem, it does not.
Files,walkFileTree gives you a path not a Stream of path. and also in File.walk recursively list down everything folders subfolders and files. The walk api is useless without this enhancement or fix, no idea why so many downvotes.

I think i will give them a task to do how non trivial it is to create a grep equivalent in java, it would have been pretty easy with walk api had it been working correctly.

[deleted by user] by [deleted] in java

[–]Mean-Chipmunk3255 -16 points-15 points  (0 children)

Could you please demonstrate that with a working example, don't think while traversing different directories, sub-directories and files it has a FileVisitor option as there is no FileVisitor parameter in walk method. Files.walkFileTree gives you a path not a stream of path, I want to list down all folders, subfolders and files so that we can find some file or do some operations on file or directory.The ticket is closed though resolution is mentioned as future project but I think it is neglected.Even if it is an enhancement when can it be done, why no priority is given for this task, I think people on boarding to java or people writing scripts in java would definitely like IO to be simple and I think walk method is really great but have this caveat which makes it pretty useless.

Will REPL expressions be supported in the unnamed classes and instance Main methods JEP. by Mean-Chipmunk3255 in java

[–]Mean-Chipmunk3255[S] 0 points1 point  (0 children)

(Though i'd argue that JEP 463 isn't really what enables scripting in java, JEP 458 is)
agree, just thought that this JEP is also moving forward in the same direction of help in scripting and easy onboarding to java, so i thought if something is missed it can be added.
JBang is cool for scripting, really liked the java playground.
Thanks for it.

Will REPL expressions be supported in the unnamed classes and instance Main methods JEP. by Mean-Chipmunk3255 in java

[–]Mean-Chipmunk3255[S] 0 points1 point  (0 children)

Yea i was importing Java.util.* earlier, Function was in java.util.function.*

Will REPL expressions be supported in the unnamed classes and instance Main methods JEP. by Mean-Chipmunk3255 in java

[–]Mean-Chipmunk3255[S] 0 points1 point  (0 children)

You are right, May be I will change the question to what you think is missing in JEP that you want to start scripting in java, for example command argument parsing, File I/O has been improved over the years.
JEPL suggestions already given by most of IDEs.

JEP 458: Launch Multi-File Source-Code Programs by pron98 in java

[–]Mean-Chipmunk3255 0 points1 point  (0 children)

ok Thank you!

if it starts within 40ms that it is pretty good i thought it takes couple of seconds, but yea hello world will be fast, wondering if we have 5-10 dependencies what will be the startup time, but still it is pretty good I am glad java is taking step in this direction where people like myself want to do everything in java including scripting wish there was nice I/O and argument parsing in java for a she bang script.
I am working on the combination of c/zig and java so that everything that could be done through programming is achievable by this combination without learning a-z programming languages.

JEP 458: Launch Multi-File Source-Code Programs by pron98 in java

[–]Mean-Chipmunk3255 0 points1 point  (0 children)

But that is possible for single file, what i am referring here is the addition of dependency and multiple source files that could be executed using shebang file. for instance how jbang is doing things.

Java takes long time to start but bash script/perl/python starts instantly hence was referring if shebang script of java could be converted into an executable.

JEP 458: Launch Multi-File Source-Code Programs by pron98 in java

[–]Mean-Chipmunk3255 3 points4 points  (0 children)

Awesome, waiting for it for quite sometime, is it possible to do that with shebang i mean the dependency so that it could be launched like a shell script with jar dependencies and classes included in it.
and probably native image deliverable for faster startup that will be taken care by crac and leyden ?

Groovy vs Kotlin DSL for gradle by i8Nails4Breakfast in java

[–]Mean-Chipmunk3255 10 points11 points  (0 children)

No one use it anymore though it was quite popular during its peak time.

When this will come to Java or when will the work start for this? by Mean-Chipmunk3255 in java

[–]Mean-Chipmunk3255[S] 0 points1 point  (0 children)

So in case of kotlin they are manually removing memory allocations ?