forumthreaditerator.java
来自「Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛」· Java 代码 · 共 95 行
JAVA
95 行
/** * $RCSfile: ForumThreadIterator.java,v $ * $Revision: 1.2 $ * $Date: 2002/05/10 22:16:57 $ * * Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved. * * This software is the proprietary information of CoolServlets, Inc. * Use is subject to license terms. */package com.jivesoftware.forum;import java.util.Iterator;import java.util.NoSuchElementException;/** * An iterator for ForumThreads that allows backwards and forwards iteration, * as well as setting an index into the Iteration. */public abstract class ForumThreadIterator implements Iterator { /** * Returns <tt>true</tt> if this iterator has more threads when * traversing the list in the forward direction. (In other words, returns * <tt>true</tt> if <tt>next</tt> would return a thread rather than * throwing an exception.) * * @return <tt>true</tt> if the iterator has more threads when * traversing the list in the forward direction. */ public abstract boolean hasNext(); /** * Returns the next thread in the list. This method may be called * repeatedly to iterate through the list, or intermixed with calls to * <tt>previous</tt> to go back and forth. (Note that alternating calls * to <tt>next</tt> and <tt>previous</tt> will return the same element * repeatedly.) * * @return the next thread in the list. * @exception NoSuchElementException if the iteration has no next element. */ public abstract Object next(); /** * Returns <tt>true</tt> if this list iterator has more threads when * traversing the list in the reverse direction. (In other words, returns * <tt>true</tt> if <tt>previous</tt> would return a thread rather than * throwing an exception.) * * @return <tt>true</tt> if the list iterator has more elements when * traversing the list in the reverse direction. */ public abstract boolean hasPrevious(); /** * Returns the previous element in the list. This method may be called * repeatedly to iterate through the list backwards, or intermixed with * calls to <tt>next</tt> to go back and forth. (Note that alternating * calls to <tt>next</tt> and <tt>previous</tt> will return the same * element repeatedly.) * * @return the previous element in the list. * * @exception NoSuchElementException if the iteration has no previous * element. */ public abstract Object previous(); /** * Sets the index for the iteration to the specified ForumThread.<p> * * Implementation note: a performance setting allows an optional short-term * cache so that object invalidations are delayed for a period of time. This * can mean that trying to set the index for a newly created thread can fail. * Ensure that this performance setting is disabled, or refrain from calling * this method with newly created threads. * * @exception NoSuchElementException if <tt>thread</tt> is not a valid * element of the iteration. */ public abstract void setIndex(ForumThread thread); /** * This method of the Iterator interface is not supported due to security * considerations. Calling it will always result in an an exception being * thrown. * * @throws UnsupportedOperationException if this method is called. */ public void remove() { throw new UnsupportedOperationException(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?