Skip to content

Tag: java

Java Fastest way to read through text file with 2 million lines

Currently I am using scanner/filereader and using while hasnextline. I think this method is not highly efficient. Is there any other method to read file with the similar functionality of this? Answer You will find that BufferedReader.readLine() is as fast as you need: you can read millions of lines a second w…

java codility Frog-River-One

I have been trying to solve a Java exercise on a Codility web page. Below is the link to the mentioned exercise and my solution. https://codility.com/demo/results/demoH5GMV3-PV8 Can anyone tell what can I correct in my code in order to improve the score? Just in case here is the task description: A small frog…

Partition a Set into smaller Subsets and process as batch

I have a continuous running thread in my application, which consists of a HashSet to store all the symbols inside the application. As per the design at the time it was written, inside the thread’s while true condition it will iterate the HashSet continuously, and update the database for all the symbols …