如何使用队列调用静态方法

How to make a call on static method with queue

// 我想把 [1, 2, 3, 4, 5, 6] 传给 mystery2 //

public static void main(String[] args) {
    mystery2(1, 2, 3, 4, 5, 6); // need help here
}

public static void mystery2(Queue<Integer> q) {    
}

你可以这样过..

mystery2(new LinkedList<>(Arrays.asList(1,2,3,4,5,6)); 

LinkedList 实现了 Queue 接口,并具有将 Collection 作为构造函数参数的构造函数。

希望这对您有所帮助。干杯!!!