@Test public void testMap() { List<Integer> list = asList(1, 2, 3); List<String> mapped = mlist(list).map(new Function<Integer, Integer>() { @Override public Integer apply(Integer a) { return a * a; } }).map(new Function<Integer, String>() { @Override public String apply(Integer a) { return a + " " + a; } }).value(); assertEquals("1 1", mapped.get(0)); assertEquals("4 4", mapped.get(1)); assertEquals("9 9", mapped.get(2)); }
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);  }