This Java Tuple library implements type-safe tuples of any size using generics. Download the source code or binary.

import com.mallardsoft.tuple.Pair;
import com.mallardsoft.tuple.Tuple;
import java.util.HashMap;
import java.util.Map;

    Map<Pair<String, String>, Integer> population = new HashMap<Pair<String, String>, Integer>();
    population.put(
        Tuple.from("TX", "Dallas"),
        1213825);

    String ip = Tuple.from(192, 168, 0, 100).toString("", ".", "");
    // ip = "192.168.0.100"

Use the links to the left to see different ways of using this tuple library. Leave a comment if you like it, dislike it, or have something new to contribute.

Michael L Perry