Example #1
0
  /**
   * Checks if all given arrays contain the same values.<br>
   * Note: Only use this method when the given arrays are sorted and contain only distinct values.
   *
   * @param arrs
   * @return
   */
  public static boolean containSameElementsSorted(short[]... arrs) {
    Validate.notNull(arrs);
    if (arrs.length == 1) return true;

    int firstSize = arrs[0].length;
    for (int i = 1; i < arrs.length; i++) {
      if (arrs[i].length != firstSize) {
        return false;
      }
    }

    for (int j = 0; j < firstSize; j++) {
      short firstValue = arrs[0][j];
      for (int k = 1; k < arrs.length; k++) {
        if (arrs[k][j] != firstValue) return false;
      }
    }
    return true;
  }
Example #2
0
 private void setPossibleValues(Class<E> enumeration) throws ParameterException {
   Validate.notNull(enumeration);
   this.enumeration = enumeration;
 }