I am trying to initialize Guava synchronizedQueue in Scala for performence benchmarking.
class TestSynchronizedQueueJavaPTS {
private var assignedQForTest : java.util.Queue[Int] = null;
private var syncQueue : java.util.Queue[Int] = null;
def create(DS_Type : String) : java.util.concurrent.ConcurrentLinkedQueue[Int] ={
DS_Type match{
case "syncQueue" =>
syncQueue = com.google.common.collect.Queues.synchronizedQueue(com.google.common.collect.MinMaxPriorityQueue.[Int]create());
assignedQForTest = syncQueue;
}
assignedQForTest
}
}
But I am getting this error:
identifier expected but '[' found.
Source of error: .[Int] part.
I have the equivalent Java Code which is working perfectly fine without any error:
import java.util.Queue;
import com.google.common.collect.MinMaxPriorityQueue;
import com.google.common.collect.Queues;
public class test {
public static void main(String[] args) {
Queue<Integer> queue = Queues.synchronizedQueue(MinMaxPriorityQueue.<Integer>create());
queue.add(15);
queue.add(63);
queue.add(20);
System.out.println (queue.poll());
System.out.println (queue.poll());
}
}