📄 arrayenumeration.java
字号:
/*
* Copyright (c) 1998, 1999 by Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation, version 2. (see COPYING.LIB)
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA
*/
package org.jfree.designer.visualeditor.treemodel;
import java.util.Enumeration;
/**
* An enumeration over an array of objects.
*/
public final class ArrayEnumeration
implements Enumeration
{
public static final ArrayEnumeration EMPTY_ENUMERATION =
new ArrayEnumeration(new Object[0]);
private Object[] objectarray = null;
private int counter = 0;
public ArrayEnumeration (final Object[] objectarray)
{
if (objectarray == null)
{
throw new NullPointerException("ObjektArray must not be null");
}
this.objectarray = objectarray;
}
/**
* Returns true if this enumeration has at least one more Element.
*/
public final boolean hasMoreElements ()
{
return (counter < objectarray.length);
}
/**
* Returns the next element in the Array.
*/
public final Object nextElement ()
{
final Object retval = objectarray[counter];
counter += 1;
return retval;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -