Code example for Collection

Methods: remove

0
     * @throws UnsupportedOperationException if no associated collection 
     */ 
    public void remove() { 
        if (collection != null) {
            if (last != null) {
                collection.remove(last);
            } else { 
                throw new IllegalStateException("next() must have been called for remove() to function");
            } 
        } else { 
            throw new UnsupportedOperationException("No Collection associated with this Iterator");
        } 
    } 
 
    // Properties 
    //----------------------------------------------------------------------- 
    /** 
     * Returns the underlying enumeration. 
     * 
     * @return the underlying enumeration