⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recyclablearray.java

📁 专业汽车级嵌入式操作系统OSEK的源代码
💻 JAVA
字号:
package lejos.util;/** * A recyclable array. It should be * allocated using an instance of <code>ArrayRecycler</code>. * @see lejos.util.ArrayRecycler */public class RecyclableArray extends AbstractRecyclable {	private static final RuntimeException INDEX_EXCEPTION = new ArrayIndexOutOfBoundsException();	private final Object[] buffer;	private int length;		RecyclableArray (int capacity) {	    buffer = new Object[capacity];		}	    public final void init() {	}		final void init (int length) {		this.length = length;		Object[] arr = this.buffer;		for (int i = 0; i < length; i++) {			arr[i] = null;		}	}		public final void release() {		// Nothing to do	}			final int getCapacity() {	    return this.buffer.length;		}		public final int getLength() {	    return this.length;		}		public final Object get (int index) {		if (index >= this.length)			throw INDEX_EXCEPTION;	    return this.buffer[index];		}		public final void put (int index, Object o) {		if (index >= this.length)			throw INDEX_EXCEPTION;        this.buffer[index] = o;	    	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -