All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy