java.lang.Object
tech.bitey.bufferstuff.BufferSort
Sorting algorithms for nio buffers.
- Author:
- biteytech@protonmail.com, heap-sort adapted from programiz.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcountingSort(ByteBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedByteBufferin ascending order (lowest first).static voidcountingSort(ShortBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedShortBufferin ascending order (lowest first).static voidcountingSort(SmallByteBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallByteBufferin ascending order (lowest first).static voidcountingSort(SmallShortBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallShortBufferin ascending order (lowest first).static voidheapSort(ByteBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedByteBufferin ascending order (lowest first).static voidheapSort(DoubleBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedDoubleBufferin ascending order (lowest first).static voidheapSort(FloatBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedFloatBufferin ascending order (lowest first).static voidSorts a range of the specifiedIntBufferin ascending order (lowest first).static voidheapSort(IntBuffer b, IntBinaryOperator comparator, int fromIndex, int toIndex) Sorts a range of the specifiedIntBufferin ascending order (lowest first).static voidheapSort(LongBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedLongBufferin ascending order (lowest first).static voidheapSort(ShortBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedShortBufferin ascending order (lowest first).static voidheapSort(SmallByteBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallByteBufferin ascending order (lowest first).static voidheapSort(SmallDoubleBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallDoubleBufferin ascending order (lowest first).static voidheapSort(SmallFloatBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallFloatBufferin ascending order (lowest first).static voidheapSort(SmallIntBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallIntBufferin ascending order (lowest first).static voidheapSort(SmallIntBuffer b, IntBinaryOperator comparator, int fromIndex, int toIndex) Sorts a range of the specifiedSmallIntBufferin ascending order (lowest first).static voidheapSort(SmallLongBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallLongBufferin ascending order (lowest first).static voidheapSort(SmallShortBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallShortBufferin ascending order (lowest first).static voidinsertionSort(ByteBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedByteBufferin ascending order (lowest first).static voidinsertionSort(DoubleBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedDoubleBufferin ascending order (lowest first).static voidinsertionSort(FloatBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedFloatBufferin ascending order (lowest first).static voidinsertionSort(IntBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedIntBufferin ascending order (lowest first).static voidinsertionSort(LongBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedLongBufferin ascending order (lowest first).static voidinsertionSort(ShortBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedShortBufferin ascending order (lowest first).static voidinsertionSort(SmallByteBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallByteBufferin ascending order (lowest first).static voidinsertionSort(SmallDoubleBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallDoubleBufferin ascending order (lowest first).static voidinsertionSort(SmallFloatBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallFloatBufferin ascending order (lowest first).static voidinsertionSort(SmallIntBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallIntBufferin ascending order (lowest first).static voidinsertionSort(SmallLongBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallLongBufferin ascending order (lowest first).static voidinsertionSort(SmallShortBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallShortBufferin ascending order (lowest first).static voidSorts a range of the specifiedIntBufferin ascending order (lowest first).static voidradixSort(LongBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedLongBufferin ascending order (lowest first).static voidradixSort(SmallIntBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallIntBufferin ascending order (lowest first).static voidradixSort(SmallLongBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallLongBufferin ascending order (lowest first).static voidsort(ByteBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedByteBufferin ascending order (lowest first).static voidsort(DoubleBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedDoubleBufferin ascending order (lowest first).static voidsort(FloatBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedFloatBufferin ascending order (lowest first).static voidSorts a range of the specifiedIntBufferin ascending order (lowest first).static voidsort(LongBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedLongBufferin ascending order (lowest first).static voidsort(ShortBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedShortBufferin ascending order (lowest first).static voidsort(SmallByteBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallByteBufferin ascending order (lowest first).static voidsort(SmallDoubleBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallDoubleBufferin ascending order (lowest first).static voidsort(SmallFloatBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallFloatBufferin ascending order (lowest first).static voidsort(SmallIntBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallIntBufferin ascending order (lowest first).static voidsort(SmallLongBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallLongBufferin ascending order (lowest first).static voidsort(SmallShortBuffer b, int fromIndex, int toIndex) Sorts a range of the specifiedSmallShortBufferin ascending order (lowest first).
-
Constructor Details
-
BufferSort
public BufferSort()
-
-
Method Details
-
heapSort
Sorts a range of the specifiedIntBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedIntBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedcomparator- used to compare values fromb. useful when the integers are identifiers or indices referencing some external data structure.fromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedLongBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedShortBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedByteBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedFloatBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedDoubleBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
radixSort
Sorts a range of the specifiedIntBufferin ascending order (lowest first). The sort is:- in-place
O(n)in the worst case. However, radix sort has more overhead than heat sort, and is only faster for large ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
radixSort
Sorts a range of the specifiedLongBufferin ascending order (lowest first). The sort is:- in-place
O(n)in the worst case. However, radix sort has more overhead than heat sort, and is only faster for large ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
countingSort
Sorts a range of the specifiedShortBufferin ascending order (lowest first). This sort isO(n)in the worst case, but it creates and iterates over anintarray of length 2^16.- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
countingSort
Sorts a range of the specifiedByteBufferin ascending order (lowest first). This sort isO(n)in the worst case, but it creates and iterates over anintarray of length 2^8.- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedIntBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedLongBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedShortBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedByteBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedFloatBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedDoubleBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedIntBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort[100 - 10^7)heapSort10^7+radixSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedLongBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort[100 - 10^7)heapSort10^7+radixSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedShortBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort[100 - 10^7)heapSort10^7+countingSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedByteBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort[100 - 10^5)heapSort10^5+countingSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedFloatBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort100+heapSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedDoubleBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort100+heapSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedSmallIntBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
public static void heapSort(SmallIntBuffer b, IntBinaryOperator comparator, int fromIndex, int toIndex) Sorts a range of the specifiedSmallIntBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedcomparator- used to compare values fromb. useful when the integers are identifiers or indices referencing some external data structure.fromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedSmallLongBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedSmallShortBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedSmallByteBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedSmallFloatBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
heapSort
Sorts a range of the specifiedSmallDoubleBufferin ascending order (lowest first). The sort is:- in-place
O(n*log(n))in the worst case- a good general-purpose sorting algorithm
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
radixSort
Sorts a range of the specifiedSmallIntBufferin ascending order (lowest first). The sort is:- in-place
O(n)in the worst case. However, radix sort has more overhead than heat sort, and is only faster for large ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
radixSort
Sorts a range of the specifiedSmallLongBufferin ascending order (lowest first). The sort is:- in-place
O(n)in the worst case. However, radix sort has more overhead than heat sort, and is only faster for large ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
countingSort
Sorts a range of the specifiedSmallShortBufferin ascending order (lowest first). This sort isO(n)in the worst case, but it creates and iterates over anintarray of length 2^16.- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
countingSort
Sorts a range of the specifiedSmallByteBufferin ascending order (lowest first). This sort isO(n)in the worst case, but it creates and iterates over anintarray of length 2^8.- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedSmallIntBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedSmallLongBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedSmallShortBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedSmallByteBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedSmallFloatBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
insertionSort
Sorts a range of the specifiedSmallDoubleBufferin ascending order (lowest first). The sort is:- in-place
O(n^2)in the worst case. However, insertion sort has less overhead than heat sort, and is faster for small ranges.
- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedSmallIntBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort[100 - 10^7)heapSort10^7+radixSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedSmallLongBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort[100 - 10^7)heapSort10^7+radixSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedSmallShortBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort[100 - 10^7)heapSort10^7+countingSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedSmallByteBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort[100 - 10^5)heapSort10^5+countingSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedSmallFloatBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort100+heapSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
sort
Sorts a range of the specifiedSmallDoubleBufferin ascending order (lowest first). The actual sorting algorithm used depends on the length of the range:Length Algorithm [0 - 100)insertionSort100+heapSort- Parameters:
b- the buffer to be sortedfromIndex- the index of the first element (inclusive) to be sortedtoIndex- the index of the last element (exclusive) to be sorted- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-