Convert text files to Java sets using commons or guava
•
Java
I want to load every line in the file into the HashSet collection Is there a simple way?
Solution
how:
Sets.newHashSet(Files.readLines(file,charSet));
(use guava)
reference:
> Files. readLines() > Sets. newHashSet()
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码