java – Collection.shuffle无效 – GWT

前端之家收集整理的这篇文章主要介绍了java – Collection.shuffle无效 – GWT前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
使用import java.util.Collections;就像我应该的那样.不是GWT的.让GWT项目的共享文件夹中包含错误的类.

代码具有以下结构:

List<String []> qaList;
qaList = new ArrayList<String[]>();

qaList.add("12345 main st","tomah");
qaList.add("124 main st","lacrosse");
qaList.add("123 main","yeeehahaaa");

Collections.shuffle(qaList);

给我这个错误

[ERROR] [_012cfaexam] – Line 109: The method shuffle(List<String[]>) is undefined for the >type Collections

解决方法

引自 GWT’s JRE Emulation Reference

Google Web Toolkit includes a library that emulates a subset of the Java runtime library. The list below shows the set of JRE packages,types and methods that GWT can translate automatically. Note that in some cases,only a subset of methods is supported for a given type.

具体来说,如果您查看Package java.util中的集合,您将看到它不包含shuffle()方法.

原文链接:https://www.f2er.com/java/127470.html

猜你在找的Java相关文章