public class ArrayQueue<T> { private int front=0;//头部指针,空 private int rear=0;//尾部指针,有值 private int maxSize=10;//容量,默认给10 private T[] array;//数组,存储内容 public ArrayQueue(Class<T> clazz,int maxSize) { this.maxSize = maxSize; array = (T[]) Array.newInstance(clazz, maxSize); } }
泛型数组初始化-java
最新推荐文章于 2024-08-12 00:20:15 发布