/** * Compares this mutable to another in ascending order. * * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater * where false is less than true */ @Override public int compareTo(final MutableBoolean other) { return BooleanUtils.compare(this.value, other.value); }
/** * <p>This method checks whether the provided array is sorted according to natural ordering * ({@code false} before {@code true}). * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(final boolean[] array) { if (array == null || array.length < 2) { return true; } boolean previous = array[0]; final int n = array.length; for (int i = 1; i < n; i++) { final boolean current = array[i]; if (BooleanUtils.compare(previous, current) > 0) { return false; } previous = current; } return true; }
/** * Compares this mutable to another in ascending order. * * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater * where false is less than true */ @Override public int compareTo(final MutableBoolean other) { return BooleanUtils.compare(this.value, other.value); }
/** * Compares this mutable to another in ascending order. * * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater * where false is less than true */ @Override public int compareTo(final MutableBoolean other) { return BooleanUtils.compare(this.value, other.value); }
/** * Compares this mutable to another in ascending order. * * @param other the other mutable to compare to, not null * @return negative if this is less, zero if equal, positive if greater * where false is less than true */ @Override public int compareTo(final MutableBoolean other) { return BooleanUtils.compare(this.value, other.value); }
/** * <p>This method checks whether the provided array is sorted according to natural ordering * ({@code false} before {@code true}). * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(final boolean[] array) { if (array == null || array.length < 2) { return true; } boolean previous = array[0]; final int n = array.length; for (int i = 1; i < n; i++) { final boolean current = array[i]; if (BooleanUtils.compare(previous, current) > 0) { return false; } previous = current; } return true; }
/** * <p>This method checks whether the provided array is sorted according to natural ordering * ({@code false} before {@code true}). * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(final boolean[] array) { if (array == null || array.length < 2) { return true; } boolean previous = array[0]; final int n = array.length; for (int i = 1; i < n; i++) { final boolean current = array[i]; if (BooleanUtils.compare(previous, current) > 0) { return false; } previous = current; } return true; }
/** * <p>This method checks whether the provided array is sorted according to natural ordering * ({@code false} before {@code true}). * * @param array the array to check * @return whether the array is sorted according to natural ordering * @since 3.4 */ public static boolean isSorted(final boolean[] array) { if (array == null || array.length < 2) { return true; } boolean previous = array[0]; final int n = array.length; for (int i = 1; i < n; i++) { final boolean current = array[i]; if (BooleanUtils.compare(previous, current) > 0) { return false; } previous = current; } return true; }