001package edu.pdx.cs410J.j2se15; 002 003/** 004 * Uses the generic {@link Tuple} class to return a host/port 005 * combination from a single method. 006 * 007 * @author David Whitlock 008 * @since Summer 2005 009 */ 010public class TupleExample { 011 012 /** 013 * Returns the host and port on which the server runs 014 */ 015 public static Tuple<String, Integer> getHostAndPort() { 016 return new Tuple<String, Integer>("pippin", 12345); 017 } 018 019 /** 020 * Main program that uses a <code>Tuple</code> 021 */ 022 public static void main(String[] args) { 023 Tuple<String, Integer> tuple; 024 025 tuple = getHostAndPort(); 026 027 String host = tuple.getFirst(); 028 int port = tuple.getSecond(); 029 030 System.out.println("Running on " + host + ":" + port); 031 } 032 033}