Here you can find the source of addElementsToQueueInSingleThread(int numberOfElements, Queue
Parameter | Description |
---|---|
numberOfElements | a parameter |
queue | a parameter |
element | a parameter |
public static double addElementsToQueueInSingleThread(int numberOfElements, Queue<Integer> queue, int element)
//package com.java2s; //License from project: Open Source License import java.util.Queue; public class Main { /**//from w w w .j av a 2 s.com * * @param numberOfElements * @param queue * @param element * @return execution time (sec) */ public static double addElementsToQueueInSingleThread(int numberOfElements, Queue<Integer> queue, int element) { long t = System.nanoTime(); for (int i = 0; i < numberOfElements; i++) { queue.add(element); } t = System.nanoTime() - t; return t / Math.pow(10, 9); } }