Here you can find the source of stackTraceEquals(StackTraceElement[] ta1, StackTraceElement[] ta2)
Parameter | Description |
---|---|
ta1 | First stack trace |
ta2 | Second stack trace |
public static boolean stackTraceEquals(StackTraceElement[] ta1, StackTraceElement[] ta2)
//package com.java2s; //License from project: Open Source License public class Main { /**// w ww .j a v a 2 s.c o m * Compares two stack traces and checks if they are equal * @param ta1 First stack trace * @param ta2 Second stack trace * @return true if they are equal, false otherwise. */ public static boolean stackTraceEquals(StackTraceElement[] ta1, StackTraceElement[] ta2) { // First check if the addresses are the same, if so, early exit if (ta1 == ta2) { return true; } if (ta1.length == ta2.length) { for (int i = 0, lnLength = ta1.length; i < lnLength; i++) { if (!equals(ta1[i], ta2[i])) { return false; } } return true; } return false; } /** * Compares two stack trace elements * @param toA first stack trace * @param toB second stack trace * @return returns true if they are equal */ public static boolean equals(StackTraceElement toA, StackTraceElement toB) { return toA == toB || (toA != null && toA.equals(toB)); } }