protected void clearInternal()

in src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java [712:741]


    protected void clearInternal() {
        setDetailEvents(false);
        boolean useIterator = true;
        try {
            final Iterator<String> it = getKeys();
            while (it.hasNext()) {
                final String key = it.next();
                if (useIterator) {
                    try {
                        it.remove();
                    } catch (final UnsupportedOperationException usoex) {
                        useIterator = false;
                    }
                }

                if (useIterator && containsKey(key)) {
                    useIterator = false;
                }

                if (!useIterator) {
                    // workaround for Iterators that do not remove the
                    // property
                    // on calling remove() or do not support remove() at all
                    clearProperty(key);
                }
            }
        } finally {
            setDetailEvents(true);
        }
    }