更新时间:2022-12-17 10:31:01
p> java.util。 ArrayList< E>
和 java.util.stack< E>
实现 java.util.List< E>
界面, Collections.shuffle ()
将一个 java.util.List<?>
作为参数呃您应该可以将 Stack
传递到 Collections.shuffle()
中,除非您使用不同的堆栈实现这不实现 java.util.list< E>
。如果你是,我建议你切换到不同的堆栈实现。
Both java.util.ArrayList<E>
and java.util.stack<E>
implement the java.util.List<E>
interface, and Collections.shuffle()
takes a java.util.List<?>
as a parameter. You should be able to pass a Stack
into Collections.shuffle()
, unless you're using a different stack implementation that does not implement java.util.list<E>
. If you are, I would advise you to switch to a different stack implementation.