Click here to Skip to main content
12,626,517 members (35,668 online)
Click here to Skip to main content
Articles » Languages » Java » General » Downloads

Tagged as

Stats

22.5K views
240 downloads
14 bookmarked
Posted

Functional Java

, 7 Dec 2010 CPOL
Functional programming with functors and object streams in Java.
package swensen.functional;

/**
 * Static helper class for creating tuples.
 * @author Stephen
 */
public final class Tuples {
    private Tuples() {}
    public static <T1> Tuple1<T1> create(T1 t1) { return Tuple1.create(t1); }
    public static <T1,T2> Tuple2<T1,T2> create(T1 t1, T2 t2) { return Tuple2.create(t1,t2); }
    public static <T1,T2,T3> Tuple3<T1,T2,T3> create(T1 t1, T2 t2, T3 t3) { return Tuple3.create(t1,t2,t3); }
    public static <T1,T2,T3,T4> Tuple4<T1,T2,T3,T4> create(T1 t1, T2 t2, T3 t3, T4 t4) { return Tuple4.create(t1,t2,t3,t4); }
    public static <T1,T2,T3,T4,T5> Tuple5<T1,T2,T3,T4,T5> create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) { return Tuple5.create(t1,t2,t3,t4,t5); }
    public static <T1,T2,T3,T4,T5,T6> Tuple6<T1,T2,T3,T4,T5,T6> create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6) { return Tuple6.create(t1,t2,t3,t4,t5,t6); }
    public static <T1,T2,T3,T4,T5,T6,T7> Tuple7<T1,T2,T3,T4,T5,T6,T7> create(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6,T7 t7) { return Tuple7.create(t1,t2,t3,t4,t5,t6,t7); }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Stephen Swensen
United States United States
I'm developing Unquote, a library for writing unit test assertions as F# quoted expressions: http://code.google.com/p/unquote/

I am working through Project Euler with F#: http://projecteulerfun.blogspot.com/

I participate in Stack Overflow: http://stackoverflow.com/users/236255/stephen-swensen

You may also be interested in...

Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161205.3 | Last Updated 7 Dec 2010
Article Copyright 2009 by Stephen Swensen
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid