class UndirectedGraphImpl implements UndirectedGraph<V, E> {

    @Override
    public E removeEdge(int e) {
        checkEdge(e);
        E obj = edges.get(e).getObject();
        if (e == edges.size() - 1) {
            edges.remove(e);
        } else {
            edges.set(e, null);
            removedEdges.add(e);
        }
        invalidateAdjacencyList();
        notifyListener();
        return obj;
    }

}