Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 package org.myoodb.collectable; 25 26 public class IteratorDbImpl extends org.myoodb.MyOodbObject implements Iterator 27 { 28 private int m_index; 29 private java.util.Collection m_collection; 30 31 public IteratorDbImpl(java.util.Collection collection) 32 { 33 m_index = 0; 34 m_collection = collection; 35 } 36 37 public boolean hasNext() 38 { 39 return m_index < m_collection.size(); 40 } 41 42 public Object next() 43 { 44 Object retval = null; 45 46 if (hasNext() == true) 47 { 48 m_index++; 49 50 java.util.Iterator iter = m_collection.iterator(); 51 for (int i = 1; i <= m_index; i++) 52 { 53 Object tmp = iter.next(); 54 55 if (i == m_index) 56 { 57 retval = tmp; 58 break; 59 } 60 } 61 } 62 63 return retval; 64 } 65 66 public void remove() 67 { 68 java.util.Iterator iter = m_collection.iterator(); 69 for (int i = 1; i <= m_index; i++) 70 { 71 Object tmp = iter.next(); 72 73 if (i == m_index) 74 { 75 iter.remove(); 76 m_index--; 77 break; 78 } 79 } 80 } 81 } 82
| Popular Tags
|