Can you show an example of a java program that reads in a large data set from a file using thread pools, callables and futures, adding the values to a list?
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.io.*;
class CallableExample implements Callable
{
public Object call() throws Exception
{
Random generator = new
Random();
File f = new File("a.txt");
BufferedReader br = new
BufferedReader(new FileReader(f));
String s;
while ((s = br.readLine()) !=
null)
System.out.println(s);
Thread.sleep(1000);
return s;
}
}
class A
{
public static void main(String[] args) throws
Exception
{
FutureTask[] randomNumberTasks =
new FutureTask[5];
for (int i = 0; i < 5;
i++)
{
Callable
callable = new CallableExample();
randomNumberTasks[i] = new FutureTask(callable);
Thread t = new
Thread(randomNumberTasks[i]);
t.start();
}
}
}



Can you show an example of a java program that reads in a large data set...
Develop a java program using multithreading in which each thread reads data from two separate input text files and display each line of data from each file on the Console alternatively such that one line from the first input file is printed and then one line from the other input file is printed etc.
How would you set these up using the load method in Java? Load menu reads the menu data file and returns the array list of menu item objects Load bankers reads the bankers data file and returns the array list of banker objects Load accounts reads the accounts data file and returns the array list of account objects Load customers reads the customer data file and returns the array list of customer objects Load apr reads the apr data file...
IN JAVA. Write a program that reads a file (provided as attachment to this assignment) and writes the file to a different file with line numbers inserted at the beginning of each line. For example if file input is: This is a test File output should be 1. This is a test ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BELOW FROM NOTEPAD FILE. This file contains lines of text to determine if you can properly read and write from a file.
Write a java program that reads a given data file called tickets that consists of tickets and the ticket prices. Your program should read the data and compute the find minimum, maximum and average ticket prices and output the report into a file called output.txt. The report file should look exactly (or better than) the one shown below. Your program should implement the Java ArrayList class, Java File I/O, and Java error handling exception. Below is the content of the...
Write a program in Java that reads the file and does two things: Write to an output file called dataSwitch.txt the same data from the input file, but switch the order of the data entries on each line. For example, if the first line of the input file is “90001 57110”, the first line of the output file would be “57110 90001”. Additionally, print to the screen the number of lines in the file with a label
java question: Write a program that reads in data from a text file named in.txt. Compute the sum of all the valid integers in the input file. Likewise, compute the sum of all the valid doubles in the input file. Write the former to an output file called int_total.txt, and write the latter to an output file called double_total.txt. B) Write a program that converts the Java source code from the next-line brace style to the end-of-line brace style. For...
In java
Assignment Modify the code Binary File IO Example Code. The code reads and prints information about a BMP file. Modify the code so that it also prints the resolution of the BMP file (both width and height) and the number of bits per pixel. Do not use any Java library or third-party library code that reads BMP files. You must read the file using simple Java code and extract the information, similar to the code in the example....
This is a java question A palindrome is a word or phrase that reads the same forward and backward, ignoring blanks and punctuations, and considering uppercase and lowercase versions of the same letter to be equal. For example, the following are palindromes: warts n straw radar Able was I ere I saw Elba tacocat Write a program named Palindrome.java that will accept a file (file name) from the command argument list and decide whether each line in the file is...
Help in JAVA please Write a program that reads a list of students (first names only) from a file. It is possible for the names to be in unsorted order in the file but they have to be placed in sorted order within the linked list. The program should use a doubly linked list. Each node in the doubly linked list should have the student’s name, a pointer to the next student, and a pointer to the previous student. Here...
Java. (20 pts) Write a program that reads all the numbers from the file mynums.dat and prints out the sum of the positive values from the file. Assume that the file contains only numeric values. You must output an error if the file can't be opened. You must write the complete program and the output when the program runs successfully must conform exactly to the sample output. Bonus ( 5 pts). Output an error if the file contains non-numeric...