我正在尝试返回从 ArrayDeque 内给定数组的第二个元素中提取的字符串
我尝试在 ToArray 之后强制转换它和 toString 和连接,但我得到了这个......我需要将它作为字符串返回
“表达式的类型必须是数组类型,但它解析为字符串”
ArrayDeque<String[]> bindings_and_var = new ArrayDeque();
public ArrayDeque<String[]> pushBindings(String var, String bindings) {
//var first element, bindings 2nd
String[] this_bindings_and_var = new String[2];
bindings_and_var.addLast(this_bindings_and_var);
return bindings_and_var;
}
public ArrayDeque<String[]> bindingsVal() {
return bindings_and_var;
}
public String lookup(int index) {
String[] array = (String[]) bindings_and_var.toArray();
//PROBLEM AREA vvv
String s = "" + array[index][1];
return s;