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

📄 ex8_11.txt

📁 j2ee core design patterns
💻 TXT
字号:
Example 8.11  RowSetWrapperList.java: Inner class DataRowListIterator
package com.corej2eepatterns.to.lists;

// imports 

public class RowSetWrapperList 
implements List, Serializable {

	. . .

	private class DataRowListIterator implements ListIterator {
		int currentRow=0;
		// sets the rowset cursor to next and returns
		// the Transfer object
		public Object next() {
		// get transfer object for next row of RowSetWrapperList
		currentRow++; 
		return this.get(currentRow);  
	}

	public Object previous() {
		// get transfer object for previous row of
		// RowSetWrapperList  
		currentRow--; 
		return this.get(currentRow);  

	}

	// Implement the List Iterator interface
	public boolean hasNext() {
		// Check the cursor position in the rowSet using
		// isLast, isAfterLast, isEmpty methods and
		// return true or false accordingly
	}

	public boolean hasPrevious() {
		// Check the cursor position in the rowSet using
		// isFirst, isBeforeFirst, isEmpty methods and
		// return true or false accordingly
	}

	// implement other ListIterator methods

	public int nextIndex() {
		. . .
	}

	public int previousIndex() {
		. . .
	}

	// optional methods not implemented throw
	// UnsupportedException
	public void set(Object o) {
		throw new UnsupportedOperationException();
	}

	public void add(Object o) {
		throw new UnsupportedOperationException();
	}
	. . .
}

⌨️ 快捷键说明

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