private boolean add()

in apache-rat-core/src/main/java/org/apache/rat/utils/ReportingSet.java [112:130]


    private boolean add(final boolean reportDup, final T e) {
        if (delegate.contains(e)) {
            String msg = String.format("%s", ReportingSet.this.duplicateFmt.apply(e));
            if (reportDup) {
                msg =  String.format("%s (action: %s)", msg, duplicateOption);
                DefaultLog.getInstance().log(duplicateLogLevel, msg);
            }
            switch (duplicateOption) {
            case FAIL:
                throw new IllegalArgumentException(msg);
            case IGNORE:
                return false;
            case OVERWRITE:
                delegate.remove(e);
                return delegate.add(e);
            }
        }
        return delegate.add(e);
    }