你能解释一下为什么会出现这种情况,以及我应该如何修复它吗?
我正在使用Oracle-ADF和shuttle组件。我使用 sos1.getValue();
获取所选值。
getValue() 方法返回一个对象,我正在尝试将其转换为ArrayList,以便稍后可以处理它。因此,我创建了 ArrayList sos1Value
然而,这行代码正在疯狂地出错:
sos1Value = (ArrayList) Arrays.asList(sos1.getValue());
我一直遇到 java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList
的问题。
我尝试了其他方法,例如:sos1Value = (ArrayList) sos1.getValue();
但仍然出现同样的问题,我该怎么办?
List
? - TheLostMindList<Foo> list = new ArrayList<>(Arrays.asList(sos1.getValue());
:) - TheLostMindnew ArrayList<String>( Arrays.asList(new String[] { "hey", "yo"}))
也可以工作。 - absin