Method
insertionSort
(T[] array,
Comparator<? super T> comparator)
Source from the content-addressed store, hash-verified
| 243 | } |
| 244 | |
| 245 | private static <T> void insertionSort(T[] array, |
| 246 | Comparator<? super T> comparator) |
| 247 | { |
| 248 | for (int j = 1; j < array.length; ++j) { |
| 249 | T t = array[j]; |
| 250 | int i = j - 1; |
| 251 | while (i >= 0 && comparator.compare(array[i], t) > 0) { |
| 252 | array[i + 1] = array[i]; |
| 253 | i = i - 1; |
| 254 | } |
| 255 | array[i + 1] = t; |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | public static int hashCode(Object[] array) { |
| 260 | if(array == null) { |
Tested by
no test coverage detected