0
class CircularArrayDeque<E> implements Deque {
  private E[] items;
  private int currentSize, capacity, front, back;
  private static final int DEFAULT_CAPACITY = 10;

  public CircularArrayDeque(Collection<? extends E> other) {     
    items = (E[]) other.toArray();
    currentSize = other.size();
    front = 0;
    back = currentSize - 1;
  }
}
public static void main(String[] args) {

    int[] arr = {8, 7, 5, 3, 6, 7, 12, 4};
}

我希望能够将 arr 运行到构造函数 CircularArrayDeque(arr) 中。Deque 只是我写的一个接口,它不是 java 的类。如果可能的话,我不确定我该怎么做。或者我可以将我的 arr 更改为 Object Integer,例如.....

Integer[] arr = {8, 7, 5, 3, 6, 7, 12, 4};
4

1 回答 1

2

尝试这个:

final Collection<Integer> coll = Arrays.asList(8, 7, 5, 3, 6, 7, 12, 4);
于 2013-02-06T03:38:13.630 回答