|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
S
- the "self" type of this assertion class that must be a array type (e.g. arrays, collections).E
- the array element type.public interface ArraySortedAssert<S,E>
Assertions applicable to primitive arrays or arrays of elements wether naturally Comparable
or according to a
given Comparator
.
Note that the contract defined here is can't be totally applied to List (that's why its name is not SortedAssert), the differences being that we can't check that - for empty List - the list parameter is comparable or compatible with given comparator due to type erasure.
Method Summary | |
---|---|
S |
isSorted()
Verifies that the actual array is sorted into ascending order according to the natural ordering of its elements. |
S |
isSortedAccordingTo(Comparator<? extends E> comparator)
Verifies that the actual array is sorted according to the given comparator. |
Method Detail |
---|
S isSorted()
All array elements must be primitive or implement the Comparable
interface and must be mutually comparable
(that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the array), examples :
this
assertion object.
AssertionError
- if the actual array is not sorted into ascending order according to the natural ordering of
its elements.
AssertionError
- if the actual array is null
.
AssertionError
- if the actual array element type does not implement Comparable
.
AssertionError
- if the actual array elements are not mutually Comparable
.S isSortedAccordingTo(Comparator<? extends E> comparator)
comparator
- the Comparator
used to compare array elements
this
assertion object.
AssertionError
- if the actual array is not sorted according to the given comparator.
AssertionError
- if the actual array is null
.
NullPointerException
- if the given comparator is null
.
AssertionError
- if the actual array elements are not mutually comparabe according to given Comparator.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |