O'Reilly logo

Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition by Rolf W. Rasmussen, Khalid A. Mughal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10. Fundamental Classes

10.1
 /** * Aggregate pairs of arbitrary objects. */ public final class Pair { private Object first, second; /** Construct a Pair object. */ public Pair(Object one, Object two) { first = one; second = two; } /** Provides access to the first aggregated object. */ public Object getFirst() { return first; } /** Provides access to the second aggregated object. */ public Object getSecond() { return second; } /** @return true if the pair of objects are identical. */ public boolean equals(Object other) { if (! (other instanceof Pair)) return false; Pair otherPair = (Pair) other; return first.equals(otherPair.getFirst()) && second.equals(otherPair.getSecond()); } /** @return a hash code for the aggregate pair. */ public int hashCode() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required