/** * <P> * Returns the next element in the enumeration. If there is no element * left in the enumeration an exception will be thrown. * </P> * * @exception java.util.NoSuchElementException * Thrown if the collection is exhausted. */ @Override public InetAddress nextElement() { if (!hasMoreElements()) throw new NoSuchElementException("End of Range"); InetAddress element = make(m_next); m_next = m_next.add(BigInteger.ONE); return element; }
/** * <P> * Returns an Iterator object that can be used to step through all the * address encapsulated in the object. * </P> * * <P> * The iterator returns objects of type * {@link java.net.InetAddress InetAddress}or <code>null</code> if the * address is unknown. * </p> * * @see java.net.InetAddress * @return a {@link java.util.Iterator} object. */ @Override public Iterator<InetAddress> iterator() { return new IPAddressRangeGenerator(m_begin, m_end); }
/** * <P> * Returns an Enumeration object that can be used to list out all the * address contained in the encapsulated range. * </P> * * <P> * The iterator returns objects of type * {@link java.net.InetAddress InetAddress}or <code>null</code> if the * address is unknown. * </p> * * @see java.net.InetAddress */ Enumeration<InetAddress> elements() { return new IPAddressRangeGenerator(m_begin, m_end); }
/** * <P> * Returns the next object in the iteration. If there are no objects * left in the iteration an exception will be thrown. * </P> * * @exception java.util.NoSuchElementException * Thrown if the collection is exhausted. */ @Override public InetAddress next() { return nextElement(); }
/** * <P> * Returns true if there are more elements in the iteration. * </P> */ @Override public boolean hasNext() { return hasMoreElements(); }