Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The issue here is that the <code>Pattern</code> class does not implement <code>equals()</code>, so you can't compare the collections easily. To get around this, create your own Pattern wrapper class, which holds a <code>Pattern</code> and implements <code>equals()</code>. For example:</p> <pre><code>public class PatternWrapper{ private final Pattern pattern; public PatternWrapper(Pattern p) { this.pattern = p; } /** * @return the pattern */ public Pattern getPattern() { return pattern; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((pattern == null) ? 0 : pattern.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) return true; if (!(obj instanceof PatternWrapper)) return false; PatternWrapper other = (PatternWrapper) obj; if (pattern == null) { if (other.pattern != null) return false; } else if (!pattern.toString().equals(other.pattern.toString())) return false; return true; } } </code></pre> <p>Now you can store <code>PatternWrapper</code> objects in your collections instead.</p> <p>Since you want to <strong>ignore</strong> ordering when comparing the collections, you can't simply call <code>equals</code> between the two collections, because that will compare corresponding elements. However, you can use another library such as Apache commons-collections <a href="http://commons.apache.org/collections/api/org/apache/commons/collections/CollectionUtils.html#isEqualCollection%28java.util.Collection,%20java.util.Collection%29" rel="nofollow noreferrer">CollectionUtils#isEqualCollection</a> to compare them independent of order. Take a look at this SO question for more info: <a href="https://stackoverflow.com/questions/1565214/is-there-a-way-to-check-if-two-collections-contain-the-same-elements-independent">Is there a way to check if two Collections contain the same elements, independent of order?</a></p> <p>I don't think there is a simple way of matching two regexes which have different patterns but match the same text. One way might be to have a list of test strings which you can run against each regex to see if they match.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload