CPD Results
The following document contains the results of PMD's CPD 7.7.0.
Duplications
File | Line |
---|---|
info/sixcorners/closer/Closer.java | 78 |
info/sixcorners/closer/ConcurrentCloser.java | 119 |
} /** * Closes the associated {@link AutoCloseable} * * <p>Repeated calls will do nothing. */ @Override public void close() { compact(this, 1); justClose(); } /** Calls {@link #close} */ @Override public void run() { close(); } } /** * Remove closed {@link Handle}s * * @param startWith {@link Handle} to start with * @param modLimit number of modifications to make */ public static void compact(Handle startWith, int modLimit) { Handle prev = startWith; for (Handle handle = startWith.next; handle != null; handle = handle.next) { if (handle.closeable == null) continue; if (prev.next != handle) prev.next = handle; if (modLimit-- <= 0) break; prev = handle; } } /** * Remove closed {@link Handle}s * * @param startWith {@link Handle} to start with */ public static void compact(Handle startWith) { compact(startWith, Integer.MAX_VALUE); } /** Remove closed {@link Handle}s */ public void compact() { if (head != null) compact(head); } int size() { int i = 0; for (Handle handle = head; handle != null; handle = handle.next) i++; return i; } |