<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FCollections_Data_Structure%2FDictionary</id>
		<title>Java/Collections Data Structure/Dictionary - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FCollections_Data_Structure%2FDictionary"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Collections_Data_Structure/Dictionary&amp;action=history"/>
		<updated>2026-04-18T20:53:27Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Collections_Data_Structure/Dictionary&amp;diff=9133&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Collections_Data_Structure/Dictionary&amp;diff=9133&amp;oldid=prev"/>
				<updated>2010-06-01T07:25:55Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 07:25, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Collections_Data_Structure/Dictionary&amp;diff=9132&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Collections_Data_Structure/Dictionary&amp;diff=9132&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:49Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Random-access dictionary ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
// ArrayDictionary.java&lt;br /&gt;
// $Id: ArrayDictionary.java,v 1.16 2000/08/16 21:37:57 ylafon Exp $&lt;br /&gt;
// (c) COPYRIGHT MIT and INRIA, 1996.&lt;br /&gt;
// Please first read the full copyright statement in file COPYRIGHT.html&lt;br /&gt;
&lt;br /&gt;
import java.util.Dictionary;&lt;br /&gt;
import java.util.Enumeration;&lt;br /&gt;
import java.util.Vector;&lt;br /&gt;
import java.io.DataInputStream;&lt;br /&gt;
import java.io.InputStream;&lt;br /&gt;
import java.io.PrintStream;&lt;br /&gt;
/**&lt;br /&gt;
 * Random-access dictionary:&lt;br /&gt;
 * like a dictionary but with a certain Vector-ness to it&lt;br /&gt;
 * Besides all the methods from Dictionary, it also has methods that&lt;br /&gt;
 * permit direct access to the nth element or nth key.&lt;br /&gt;
 * Should be used with care...it&amp;quot;s not too well tested yet, and it&lt;br /&gt;
 * is very exposed.&lt;br /&gt;
 * &amp;lt;p&amp;gt;This class does &amp;lt;em&amp;gt;not&amp;lt;/em&amp;gt; provide thread-safeness, for the sake of&lt;br /&gt;
 * efficiency, again it should be used with care !&lt;br /&gt;
 * @author Antonio Ram&amp;amp;iacute;rez&lt;br /&gt;
 */&lt;br /&gt;
public class ArrayDictionary extends Dictionary implements Cloneable {&lt;br /&gt;
    /** The array of keys */&lt;br /&gt;
    protected Object[] keys ;&lt;br /&gt;
    /** The array of corresponding values */&lt;br /&gt;
    protected Object[] values ;&lt;br /&gt;
    /** How many real elements are in */&lt;br /&gt;
    protected int nelems ;&lt;br /&gt;
    /** By how much to grow */&lt;br /&gt;
    protected int incr ;&lt;br /&gt;
    /**&lt;br /&gt;
     * Create an ArrayDictionary using default values for initial size and&lt;br /&gt;
     * increment.&lt;br /&gt;
     */&lt;br /&gt;
    public ArrayDictionary() {&lt;br /&gt;
  this(10,10) ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Create an ArrayDictionary using the given initial size.&lt;br /&gt;
     * (The increment is set to the same value).&lt;br /&gt;
     * @param init The initial size&lt;br /&gt;
     */&lt;br /&gt;
    public ArrayDictionary(int init) {&lt;br /&gt;
  this(init,init) ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Clone this array dictionary.&lt;br /&gt;
     * &amp;lt;p&amp;gt;As for hashtables, a shallow copy is made, the keys and elements&lt;br /&gt;
     * themselves are &amp;lt;em&amp;gt;not&amp;lt;/em&amp;gt; cloned.&lt;br /&gt;
     * @return The clone.&lt;br /&gt;
     */&lt;br /&gt;
    public Object clone() {&lt;br /&gt;
  try {&lt;br /&gt;
      ArrayDictionary cl = (ArrayDictionary) super.clone();&lt;br /&gt;
      cl.values = new Object[values.length];&lt;br /&gt;
      System.arraycopy(values, 0, cl.values, 0, values.length);&lt;br /&gt;
      cl.keys = new Object[values.length];&lt;br /&gt;
      System.arraycopy(keys, 0, cl.keys, 0, keys.length);&lt;br /&gt;
      return cl;&lt;br /&gt;
  } catch (CloneNotSupportedException ex) {&lt;br /&gt;
      throw new InternalError();&lt;br /&gt;
  }&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Create an ArrayDictionary using the given initial size and&lt;br /&gt;
     * the given increment for growing the array.&lt;br /&gt;
     * @param init the initial size&lt;br /&gt;
     * @param incr the increment&lt;br /&gt;
     */&lt;br /&gt;
    public ArrayDictionary(int init, int incr) {&lt;br /&gt;
  keys = new Object[init] ;&lt;br /&gt;
  values = new Object[init] ;&lt;br /&gt;
  this.incr = incr ;&lt;br /&gt;
  nelems = 0 ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Create an ArrayDictionary, contructing the arrays of keys and&lt;br /&gt;
     * values from the two given vectors.&lt;br /&gt;
     * The two vectors should have the same size.&lt;br /&gt;
     * The increment is set to the number of elements.&lt;br /&gt;
     * @param keys the vector of keys&lt;br /&gt;
     * @param values the vector of values&lt;br /&gt;
     */&lt;br /&gt;
    public ArrayDictionary(Vector keys,Vector values) {&lt;br /&gt;
  this(keys,values,values.size()) ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Create an ArrayDictionary, contructing the arrays of keys and&lt;br /&gt;
     * values from the two given vectors.&lt;br /&gt;
     * The two vectors should have the same size.&lt;br /&gt;
     * @param keys the vector of keys&lt;br /&gt;
     * @param values the vector of values&lt;br /&gt;
     * @param incr the increment for growing the arrays&lt;br /&gt;
     */&lt;br /&gt;
    public ArrayDictionary(Vector keys, Vector values, int incr) {&lt;br /&gt;
  this.incr = incr ;&lt;br /&gt;
  nelems = keys.size() ;&lt;br /&gt;
  this.keys = new Object[nelems] ;&lt;br /&gt;
  this.values = new Object[nelems] ;&lt;br /&gt;
  keys.copyInto(this.keys) ;&lt;br /&gt;
  values.copyInto(this.values) ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Create an ArrayDicitonary, &amp;lt;em&amp;gt;using&amp;lt;/em&amp;gt; (not copying) the given pair&lt;br /&gt;
     * of arrays as keys and values. The increment is set to the length of the&lt;br /&gt;
     * arrays. &lt;br /&gt;
     * @param keys the array of keys&lt;br /&gt;
     * @param values the array of values&lt;br /&gt;
     */&lt;br /&gt;
    public ArrayDictionary(Object[] keys, Object[] values) {&lt;br /&gt;
  this(keys,values,values.length) ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Create an ArrayDicitonary, &amp;lt;em&amp;gt;using&amp;lt;/em&amp;gt; (not copying) the given pair&lt;br /&gt;
     * of arrays as keys and values.&lt;br /&gt;
     * @param keys the array of keys&lt;br /&gt;
     * @param values the array of values&lt;br /&gt;
     * @param incr the increment for growing the arrays&lt;br /&gt;
     */&lt;br /&gt;
    public ArrayDictionary(Object[] keys, Object[] values, int incr) {&lt;br /&gt;
  this.incr = incr ;&lt;br /&gt;
  nelems = keys.length ;&lt;br /&gt;
  this.keys = keys ;&lt;br /&gt;
  this.values = values ;&lt;br /&gt;
    }&lt;br /&gt;
    protected final void grow() {&lt;br /&gt;
  grow(keys.length+incr) ;&lt;br /&gt;
    }&lt;br /&gt;
    protected void grow(int newCapacity) {&lt;br /&gt;
  Object[] newKeys = new Object[newCapacity] ;&lt;br /&gt;
  Object[] newVals = new Object[newCapacity] ;&lt;br /&gt;
  System.arraycopy(keys,0,newKeys,0,keys.length) ;&lt;br /&gt;
  System.arraycopy(values,0,newVals,0,values.length) ;&lt;br /&gt;
  keys = newKeys ;&lt;br /&gt;
  values = newVals ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns an enumeration of the elements of the dictionary.&lt;br /&gt;
     * @return the enumeration&lt;br /&gt;
     */&lt;br /&gt;
    public Enumeration elements() {&lt;br /&gt;
  return new ArrayEnumeration(values,nelems) ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns the value that maps to the given key.&lt;br /&gt;
     * @param key the key&lt;br /&gt;
     * @return the value&lt;br /&gt;
     */&lt;br /&gt;
    public Object get(Object key) {&lt;br /&gt;
  int n,i;&lt;br /&gt;
  for(i=0,n=0;i&amp;lt;keys.length;i++) {&lt;br /&gt;
      if(n &amp;gt;= nelems)&lt;br /&gt;
    break ;&lt;br /&gt;
      if ( keys[i] == null )&lt;br /&gt;
    continue;&lt;br /&gt;
      if(keys[i].equals(key)) &lt;br /&gt;
    return values[i] ;&lt;br /&gt;
      n++ ;&lt;br /&gt;
  }&lt;br /&gt;
  return null;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * &amp;quot;Optimized&amp;quot; method to obtain the values&lt;br /&gt;
     * corresponding to several keys, in one swoop.&lt;br /&gt;
     * @param rKeys An array of requested keys&lt;br /&gt;
     * @return An array of corresponding values&lt;br /&gt;
     */&lt;br /&gt;
    public Object[] getMany(Object[] rKeys) {&lt;br /&gt;
  Object[] rValues = new Object[rKeys.length] ;&lt;br /&gt;
  int i,n ;&lt;br /&gt;
  for(i=0,n=0;i&amp;lt;keys.length;i++) {&lt;br /&gt;
      if(n &amp;gt;= nelems) break ;&lt;br /&gt;
      if(keys[i]==null)&lt;br /&gt;
    continue ;&lt;br /&gt;
  inloop:&lt;br /&gt;
      for(int j=0;j&amp;lt;rKeys.length;j++) &lt;br /&gt;
    if(keys[i].equals(rKeys[j])) {&lt;br /&gt;
        rValues[j] = values[i] ;&lt;br /&gt;
        break inloop ;&lt;br /&gt;
    }&lt;br /&gt;
      n++ ;&lt;br /&gt;
  }&lt;br /&gt;
  return rValues ;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    /**&lt;br /&gt;
     * Are there any entries in the dictionary?&lt;br /&gt;
     * @return &amp;lt;strong&amp;gt;true&amp;lt;/strong&amp;gt; if there are no entries,&lt;br /&gt;
     *         &amp;lt;strong&amp;gt;false&amp;gt;&amp;lt;/strong&amp;gt; otherwise.&lt;br /&gt;
     */&lt;br /&gt;
    public final boolean isEmpty() {&lt;br /&gt;
  return nelems==0 ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Increases the capacity of this dictionary to at least the&lt;br /&gt;
     * specified number of key/value mappings.&lt;br /&gt;
     * @param minCapacity the desired minimum capacity&lt;br /&gt;
     */&lt;br /&gt;
    public final void ensureCapacity(int minCapacity) {&lt;br /&gt;
  if(minCapacity&amp;gt;keys.length) grow(minCapacity) ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns an enumeration of the keys of the dictionary.&lt;br /&gt;
     * @return the enumeration&lt;br /&gt;
     */&lt;br /&gt;
    public Enumeration keys() {&lt;br /&gt;
  return new ArrayEnumeration(keys,nelems) ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Adds a mapping between a key and a value to the dictionary.&lt;br /&gt;
     * Will grow the arrays if necessary.&lt;br /&gt;
     * @param key the key&lt;br /&gt;
     * @param value the corresponding value&lt;br /&gt;
     * @return the previous value corresponding to the key, or null if&lt;br /&gt;
     *         the key is new.&lt;br /&gt;
     */&lt;br /&gt;
    public Object put(Object key,Object value) {&lt;br /&gt;
  int empty = -1 ;&lt;br /&gt;
  int i,n ;&lt;br /&gt;
  for(i=0,n=0;i&amp;lt;keys.length;i++) {&lt;br /&gt;
      if(n &amp;gt;= nelems)&lt;br /&gt;
    break ;&lt;br /&gt;
      if(keys[i] == null) {&lt;br /&gt;
    empty = i ;&lt;br /&gt;
    continue ;&lt;br /&gt;
      }&lt;br /&gt;
      if(keys[i].equals(key)) {&lt;br /&gt;
    Object prev = values[i] ;&lt;br /&gt;
    values[i]=value;&lt;br /&gt;
    return prev ;&lt;br /&gt;
      }&lt;br /&gt;
      n++ ;&lt;br /&gt;
  }&lt;br /&gt;
  if(empty!=-1) {&lt;br /&gt;
      keys[empty]=key ;&lt;br /&gt;
      values[empty]=value ;&lt;br /&gt;
      nelems++ ;&lt;br /&gt;
  } else {&lt;br /&gt;
      grow() ;&lt;br /&gt;
      keys[nelems] = key ;&lt;br /&gt;
      values[nelems++] = value ;&lt;br /&gt;
  }&lt;br /&gt;
  return null ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Removes a key (and its value) from the dictionary;&lt;br /&gt;
     * @param key the key to remove&lt;br /&gt;
     * @return the value that used to map to that key&lt;br /&gt;
     */&lt;br /&gt;
    public Object remove(Object key) {&lt;br /&gt;
  int i,n ;&lt;br /&gt;
  for(i=0,n=0;i&amp;lt;keys.length;i++) {&lt;br /&gt;
      if(n &amp;gt;= nelems)&lt;br /&gt;
    break ;&lt;br /&gt;
      if(keys[i] == null)&lt;br /&gt;
    continue ;&lt;br /&gt;
      if(keys[i].equals(key)) {&lt;br /&gt;
    nelems-- ;&lt;br /&gt;
    Object prev = values[i] ;&lt;br /&gt;
    keys[i] = values[i] = null ;&lt;br /&gt;
    return prev ;&lt;br /&gt;
      }&lt;br /&gt;
      n++ ;&lt;br /&gt;
  }&lt;br /&gt;
  return null ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns the number of elements in the dictionary&lt;br /&gt;
     * @return the number of elements&lt;br /&gt;
     */&lt;br /&gt;
    public final int size() { return nelems ; }&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns the maximum number of keys the dictionary can hold&lt;br /&gt;
     * without reallocating an array.&lt;br /&gt;
     * @return the capacity of the dictionary&lt;br /&gt;
     */&lt;br /&gt;
    public final int capacity() { return keys.length ; } &lt;br /&gt;
    /**&lt;br /&gt;
     * Returns the nth key.&lt;br /&gt;
     * @param n the index of the desired key&lt;br /&gt;
     * @return the nth key, or null if no key in that place.&lt;br /&gt;
     */&lt;br /&gt;
    public final Object keyAt(int n) {&lt;br /&gt;
  return keys[n] ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Returns the nth element (value).&lt;br /&gt;
     * @param n the index of the desired element&lt;br /&gt;
     * @return the nth element, or null if no element in that place.&lt;br /&gt;
     */&lt;br /&gt;
    public final Object elementAt(int n) {&lt;br /&gt;
  return values[n] ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Sets the element at the nth place in the array.&lt;br /&gt;
     * @param n the index of the element to change&lt;br /&gt;
     * @param newVal the value to change it to&lt;br /&gt;
     * @return the old value&lt;br /&gt;
     */&lt;br /&gt;
    public Object setElementAt(int n,Object newVal) {&lt;br /&gt;
  Object prev = values[n] ;&lt;br /&gt;
  values[n] = newVal ;&lt;br /&gt;
  return prev ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Removes the nth mapping (key/value pair) in the dictionary.&lt;br /&gt;
     * @param n the index of the element to remove&lt;br /&gt;
     * @return the old value of the element at the nth place&lt;br /&gt;
     */&lt;br /&gt;
    public Object removeElementAt(int n) {&lt;br /&gt;
  if(values[n]!=null) {&lt;br /&gt;
      Object prev = values[n] ;&lt;br /&gt;
      values[n] = keys[n] = null ;&lt;br /&gt;
      nelems--;&lt;br /&gt;
      return prev;&lt;br /&gt;
  } else return null ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Creates a string representation of the dictionary&lt;br /&gt;
     * @return the string representation.&lt;br /&gt;
     */&lt;br /&gt;
    public String toString() {&lt;br /&gt;
  StringBuffer buf = new StringBuffer(100) ;&lt;br /&gt;
  buf.append(&amp;quot;[&amp;quot;) ;&lt;br /&gt;
  for(int i=0;i&amp;lt;keys.length;i++) {&lt;br /&gt;
      if(keys[i]==null)&lt;br /&gt;
    continue ;&lt;br /&gt;
      buf.append(keys[i]) ;&lt;br /&gt;
      buf.append(&amp;quot;=&amp;quot;) ;&lt;br /&gt;
      buf.append(values[i]) ;&lt;br /&gt;
      buf.append(&amp;quot; &amp;quot;) ;&lt;br /&gt;
  }&lt;br /&gt;
  buf.append(&amp;quot;]&amp;quot;) ;&lt;br /&gt;
  return buf.toString() ;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * A kludge for testing ArrayDictionary&lt;br /&gt;
     */&lt;br /&gt;
    public static void main(String[] args)&lt;br /&gt;
    {&lt;br /&gt;
  try {&lt;br /&gt;
      PrintStream out = System.out ;&lt;br /&gt;
      DataInputStream in = new DataInputStream(System.in) ;&lt;br /&gt;
      &lt;br /&gt;
      String line = null ;&lt;br /&gt;
      out.print(&amp;quot;n ? &amp;quot;) ; out.flush() ;&lt;br /&gt;
      line = in.readLine() ;&lt;br /&gt;
      int n = Integer.parseInt(line) ;&lt;br /&gt;
      ArrayDictionary ad = new ArrayDictionary(n) ;&lt;br /&gt;
      String key = null, value = null;&lt;br /&gt;
      while(true) {&lt;br /&gt;
    out.print(&amp;quot;action ? &amp;quot;) ; out.flush() ;&lt;br /&gt;
    line = in.readLine() ;&lt;br /&gt;
    switch(line.charAt(0)) {&lt;br /&gt;
      case &amp;quot;p&amp;quot;:&lt;br /&gt;
      case &amp;quot;P&amp;quot;:&lt;br /&gt;
          out.print(&amp;quot;key ? &amp;quot;) ; out.flush() ;&lt;br /&gt;
          key = in.readLine() ;&lt;br /&gt;
          out.print(&amp;quot;value ? &amp;quot;) ; out.flush() ;&lt;br /&gt;
          value = in.readLine() ;&lt;br /&gt;
          value = (String ) ad.put(key,value) ;&lt;br /&gt;
          out.println(&amp;quot;old: &amp;quot;+value) ;&lt;br /&gt;
          break ;&lt;br /&gt;
      case &amp;quot;r&amp;quot;:&lt;br /&gt;
      case &amp;quot;R&amp;quot;:&lt;br /&gt;
          out.print(&amp;quot;key ? &amp;quot;) ; out.flush() ;&lt;br /&gt;
          key = in.readLine() ;&lt;br /&gt;
          value = (String) ad.remove(key) ;&lt;br /&gt;
          out.println(&amp;quot;old: &amp;quot;+value) ;&lt;br /&gt;
          break ;&lt;br /&gt;
      case &amp;quot;g&amp;quot;:&lt;br /&gt;
      case &amp;quot;G&amp;quot;:&lt;br /&gt;
          out.print(&amp;quot;key ? &amp;quot;) ; out.flush() ;&lt;br /&gt;
          key = in.readLine() ;&lt;br /&gt;
          value = (String) ad.get(key) ;&lt;br /&gt;
          out.println(&amp;quot;value: &amp;quot;+value) ;&lt;br /&gt;
          break ;&lt;br /&gt;
      case &amp;quot;d&amp;quot;:&lt;br /&gt;
      case &amp;quot;D&amp;quot;:&lt;br /&gt;
          out.println(ad.toString()) ;&lt;br /&gt;
          break ;&lt;br /&gt;
      case &amp;quot;q&amp;quot;:&lt;br /&gt;
      case &amp;quot;Q&amp;quot;:&lt;br /&gt;
          return ;&lt;br /&gt;
    }&lt;br /&gt;
      }&lt;br /&gt;
  } catch(Exception ex) {&lt;br /&gt;
      ex.printStackTrace() ;&lt;br /&gt;
  }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//ArrayEnumeration.java&lt;br /&gt;
//$Id: ArrayEnumeration.java,v 1.3 2000/08/16 21:37:57 ylafon Exp $&lt;br /&gt;
//(c) COPYRIGHT MIT and INRIA, 1996.&lt;br /&gt;
//Please first read the full copyright statement in file COPYRIGHT.html&lt;br /&gt;
&lt;br /&gt;
/** Iterates through array skipping nulls. */&lt;br /&gt;
class ArrayEnumeration implements Enumeration {&lt;br /&gt;
 private int nelems ;&lt;br /&gt;
 private int elemCount ;&lt;br /&gt;
 private int arrayIdx ;&lt;br /&gt;
 private Object[] array ;&lt;br /&gt;
 public ArrayEnumeration(Object[] array) {&lt;br /&gt;
this(array,array.length) ;&lt;br /&gt;
 }&lt;br /&gt;
 public ArrayEnumeration(Object[] array,int nelems) {&lt;br /&gt;
arrayIdx = elemCount = 0 ;&lt;br /&gt;
this.nelems = nelems ;&lt;br /&gt;
this.array = array ;&lt;br /&gt;
 }&lt;br /&gt;
 public final boolean hasMoreElements() {&lt;br /&gt;
return elemCount&amp;lt;nelems ;&lt;br /&gt;
 }&lt;br /&gt;
 public final Object nextElement() {&lt;br /&gt;
while(array[arrayIdx]==null &amp;amp;&amp;amp; arrayIdx&amp;lt;array.length)&lt;br /&gt;
   arrayIdx++ ;&lt;br /&gt;
if(arrayIdx&amp;gt;=array.length)&lt;br /&gt;
   throw new RuntimeException() ;&lt;br /&gt;
elemCount++; &lt;br /&gt;
return array[arrayIdx++] ;&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>