T
- the actual type of the destination arraypublic class MergeSortedArrayLists<T>
extends java.lang.Object
MergeSortedArrayLists
merges elements of a sorted source into a
sorted destination ArrayList.
Does in-place merge of source List into the destination ArrayList using the input comparator to maintain the sort sequence of the destination ArrayList.
A buffer of destination ArrayList elements is used as the "in place" merge proceeds. The idea is to reduce the number of destination array element shifts by making a single pass through the the destination array.
Assumes that input lists are correctly sorted. Makes no assumptions about uniqueness of input keys.
If the source and destination lists contain the same key, the source element replaces the destination element.
Constructor and Description |
---|
MergeSortedArrayLists(java.util.ArrayList<T> destList,
java.util.List<? extends T> srcList,
java.util.Comparator<T> comparator,
boolean abortIfDupsFound)
Does in-place merge of source List into the destination ArrayList using
the input comparator to maintain the sort sequence of the destination
ArrayList.
|
public MergeSortedArrayLists(java.util.ArrayList<T> destList, java.util.List<? extends T> srcList, java.util.Comparator<T> comparator, boolean abortIfDupsFound) throws java.lang.IllegalArgumentException
A buffer of destination ArrayList elements is used as the "in place" merge proceeds. The idea is to reduce the number of destination array element shifts by making a single pass through the the destination array.
Assumes that input lists are correctly sorted. Makes no assumptions about uniqueness of input keys.
If the source and destination lists contain the same key, the source element replaces the destination element.
destList
- ArrayList sorted in comparator order.srcList
- List sorted in comparator order.comparator
- Comparator for comparing list object.abortIfDupsFound
- triggers IllegalObjectException if srcList object
equals a destList objectjava.lang.IllegalArgumentException
- if a srcList object equals a destList
object and abortIfDupsFound is true (the normal situation for
Theorem Loader.)