@Test public void testZip() { { List<Tuple<String, Integer>> r = mlist(new String[]{"a", "b", "c"}).zip(list(1, 2, 3, 4, 5)).value(); assertEquals(3, r.size()); assertEquals(tuple("b", 2), r.get(1)); } { List<Tuple<String, Integer>> r = mlist(new String[]{"a", "b", "c"}).zip(Collections.<Integer>nil()).value(); assertEquals(0, r.size()); } { List<Tuple<String, Integer>> r = mlist(list("a", "b", "c")).zip(list(1, 2)).value(); assertEquals(2, r.size()); assertEquals(tuple("b", 2), r.get(1)); } { List<Tuple<String, Integer>> r = mlist(list("a", "b", "c").iterator()).zip(list(1, 2)).value(); assertEquals(2, r.size()); assertEquals(tuple("b", 2), r.get(1)); } { List<Tuple<String, Integer>> r = mlist(Collections.<String>nil().iterator()).zip(list(1, 2)).value(); assertEquals(0, r.size()); } }
public static <A> ListMonadic<A> mlist(final Collection<A> as) { return mlist(new ArrayList<A>(as)); }
Monadics { public static <A> ListMonadic<A> mlist(final Collection<A> as) { return mlist(new ArrayList<A>(as)); } }
Monadics { public static <A> ListMonadic<A> mlist(final Collection<A> as) { return mlist(new ArrayList<A>(as)); } private  Monadics(); }
Monadics { public static <A> ListMonadic<A> mlist(final Collection<A> as) { return mlist(new ArrayList<A>(as)); } private  Monadics(); static ListMonadic<A> mlist(final Collection<A> as); static ListMonadic<A> mlist(final List<A> as); static ListMonadic<A> mlist(final A... as); static ListMonadic<A> mlist(final Iterator<A> as); static IteratorMonadic<A> mlazy(final Iterator<A> as); static IteratorMonadic<A> mlazy(final List<A> as); }
Monadics { public static <A> ListMonadic<A> mlist(final Collection<A> as) { return mlist(new ArrayList<A>(as)); } private  Monadics(); static ListMonadic<A> mlist(final Collection<A> as); static ListMonadic<A> mlist(final List<A> as); static ListMonadic<A> mlist(final A... as); static ListMonadic<A> mlist(final Iterator<A> as); static IteratorMonadic<A> mlazy(final Iterator<A> as); static IteratorMonadic<A> mlazy(final List<A> as);  }