Class CartesianProduct<T>


  • public class CartesianProduct<T>
    extends java.lang.Object
    A cartesian product between two lists A and B is the set of all ordered pairs of the elements of both sets. See http://en.wikipedia.org/wiki/Cartesian_product for more details. Since the order of the elements matters; Lists are used instead of Sets. Example: A = {1, 2, 3} B = {4, 5} The ordered pairs are {1, 4}, {1, 5}, {2, 4}, .., {3, 5}
    Author:
    Peter Rose
    • Constructor Summary

      Constructors 
      Constructor Description
      CartesianProduct​(java.util.List<T> list1, java.util.List<T> list2)
      Class constructor specifying the two lists of a cartesian product.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<OrderedPair<T>> getOrderedPairs()
      Generates the list of ordered pair between two sets.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CartesianProduct

        public CartesianProduct​(java.util.List<T> list1,
                                java.util.List<T> list2)
        Class constructor specifying the two lists of a cartesian product.
    • Method Detail

      • getOrderedPairs

        public java.util.List<OrderedPair<T>> getOrderedPairs()
        Generates the list of ordered pair between two sets.
        Returns:
        the list of ordered pairs