Menu
support@authoritypapers.com
+1(805) 568 7317

java question be detailed and have clear explanation will give thumbs up rating if s 5152280

java question, be detailed and have clear explanation. will give thumbs up rating if solved in 20 minutes

Explain how this program works and how it uses Java concurrency concepts. import java.util.concurrent.Callable; import java.u

Explain how this program works and how it uses Java concurrency concepts. import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor Service; import java.util.concurrent.Executors, import java.util.concurrent.Future; import java.util.Hash Map; import java.util.Iterator: import java.util.Random; import java.util.Set: import java.util.HashSet; import java.util.Map.Entry; UU class Element public String name; public double mass; // kg Element(String name, double mass) { this.name = name; this.mass = mass; We me computation class EnergyCalculation implements Callable Double> { public Element; // kg final double SPEED_OF_LIGHT = 2.99792458E8; // m/s Energy Calculation(Element e) { this.elemente; public Double call() throws InterruptedException { Thread.sleep(new Random(.nextInt(5) 1000); return this.clement.mass * Math.pow(SPEED OF LIGHT, 2); public class Concurrency { public static void main(String[] args) { // Set Element elements = new HashSct0; elements.add(new Element(“Uranium”, 5.392)); elements.add(new Element(“Gold”, 11.3)); elements.add(new Element(“Cadmium”, 24.039)); elements.add(new Element(“Caesium”, 0.353)); try { Executor Service executor – Executors.newFixedThreadPool(2); HashMap> futures = new HashMap0; for (Elemente: elements) { Future Double> future = executor.submit(new EnergyCalculation(e)); futures.put(e.name, future); executor.shutdown(); System.out.println(“Results of Mass-Energy Equivalence Calculations:”); Iterator>> it = futures.entrySct.iteratorO; while (it.hasNext() { Entry> element = it.next0; String clementName = element.getKeyO: Future

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon
"GET15"

Order Now