edu.pdx.cs.joy.lang.TupleExample Maven / Gradle / Ivy
The newest version!
package edu.pdx.cs.joy.lang;
/**
* Uses the generic {@link Tuple} class to return a host/port
* combination from a single method.
*
* @author David Whitlock
* @since Summer 2005
*/
public class TupleExample {
/**
* Returns the host and port on which the server runs
*/
public static Tuple getHostAndPort() {
return new Tuple("pippin", 12345);
}
/**
* Main program that uses a Tuple
*/
public static void main(String[] args) {
Tuple tuple;
tuple = getHostAndPort();
String host = tuple.getFirst();
int port = tuple.getSecond();
System.out.println("Running on " + host + ":" + port);
}
}