MCPcopy Create free account
hub / github.com/davidgiven/luje / countDuplicates

Method countDuplicates

lib/java/lang/Throwable.java:222–235  ·  view source on GitHub ↗

Counts the number of duplicate stack frames, starting from the end of the stack. @param currentStack a stack to compare @param parentStack a stack to compare @return the number of duplicate stack frames.

(StackTraceElement[] currentStack,
            StackTraceElement[] parentStack)

Source from the content-addressed store, hash-verified

220 * @return the number of duplicate stack frames.
221 */
222 private static int countDuplicates(StackTraceElement[] currentStack,
223 StackTraceElement[] parentStack) {
224 int duplicates = 0;
225 int parentIndex = parentStack.length;
226 for (int i = currentStack.length; --i >= 0 && --parentIndex >= 0;) {
227 StackTraceElement parentFrame = parentStack[parentIndex];
228 if (parentFrame.equals(currentStack[i])) {
229 duplicates++;
230 } else {
231 break;
232 }
233 }
234 return duplicates;
235 }
236
237 /**
238 * Returns an array of StackTraceElements. Each StackTraceElement represents

Callers

nothing calls this directly

Calls 1

equalsMethod · 0.95

Tested by

no test coverage detected