Poset extends PartiallyOrdered<Poset<C>> implements Iterable<C> { public static <C extends Comparable<?>> List<Poset<C>> cartesianProduct(Poset<C>...posets) { return cartesianProduct(Arrays.asList(posets)); } Poset(final List<C> list);  Poset(); @Override boolean isLessOrEqualTo(final Poset that); @Override boolean isLessThan(final Poset that); @Override boolean isGreaterThan(final Poset that); @Override boolean isGreaterOrEqualTo(final Poset that); static List<Poset<C>> singletons(final Collection<? extends C> collection); static List<Poset<C>> cartesianProduct(Poset<C>...posets); static List<Poset<C>> cartesianProduct(List<Poset<C>> posets); @Override Poset<C> intersect(final Poset<C> that); @Override Poset<C> union(final Poset<C> that); Poset<C> coalesce(final Poset<C> that); @Override double measure(); @Override String toString(); @Override boolean equals(final Object right); @Override int hashCode(); @Override Iterator<C> iterator(); public List<C> collection; final static Poset NULL; final static Poset MAGIC; }
@Test public void testCartesianProduct() { Poset<String> one23 = new Poset<>(new ArrayList<>(Arrays.asList("1", "2", "3"))); List<Poset<String>> product = Poset.cartesianProduct(ABC, one23); assertEquals(product.size(), 9); assertEquals(product.get(0), new Poset(new ArrayList<>(Arrays.asList("a", "1")))); assertEquals(product.get(8), new Poset(new ArrayList<>(Arrays.asList("c", "3")))); }