| JGL - The Generic Collection Library for Java |
All Packages Class Hierarchy This Package Previous Next Index
Class com.objectspace.jgl.algorithms.Swapping
java.lang.Object
|
+----com.objectspace.jgl.algorithms.Swapping
- public final class Swapping
- extends Object
The Swapping class contains generic swapping algorithms.
- See Also:
- Swapping examples
-
iterSwap(ForwardIterator, ForwardIterator)
- Swap the objects referenced by two iterators.
-
swapRanges(Container, Container)
- Swap the elements in one container with the elements in another container of the
same size.
-
swapRanges(ForwardIterator, ForwardIterator, ForwardIterator)
- Swap the elements in one sequence with the elements in another sequence of the
same size.
iterSwap
public static void iterSwap(ForwardIterator iterator1,
ForwardIterator iterator2)
- Swap the objects referenced by two iterators.
- Parameters:
- iterator1 - The first iterator.
- iterator2 - The second iterator.
swapRanges
public static ForwardIterator swapRanges(ForwardIterator first1,
ForwardIterator last1,
ForwardIterator first2)
- Swap the elements in one sequence with the elements in another sequence of the
same size.
- Parameters:
- first1 - An iterator positioned at the first element of the first sequence.
- last1 - An iterator positioned immediately after the last element of the first sequence.
- first2 - An iterator positioned at the first element of the second sequence.
- Returns:
- An iterator positioned immediately after the last element in the second sequence.
- Throws: IllegalArgumentException
- If the iterators are incompatible.
swapRanges
public static ForwardIterator swapRanges(Container container1,
Container container2)
- Swap the elements in one container with the elements in another container of the
same size.
- Parameters:
- container1 - The first container.
- container2 - The second container.
- Returns:
- An iterator positioned immediately after the last element in the second container.
All Packages Class Hierarchy This Package Previous Next Index