Module hw06

Class Dyad<F,​S>

java.lang.Object
provided.utils.struct.impl.Dyad<F,​S>
Type Parameters:
F - The type of the first element
S - The type of the second element
All Implemented Interfaces:
IDyad<F,​S>

public class Dyad<F,​S> extends Object implements IDyad<F,​S>
A class that represents a dyad (pair) of elements of possibly different types. This class is a substitute for javafx.Pair since the JavaFX project is no longer an official part of Java.
Author:
swong
  • Field Details

    • first

      private F first
      The first element
    • second

      private S second
      The second element
  • Constructor Details

    • Dyad

      public Dyad(F first, S second)
      Construct a dyad of the two given elements.
      Parameters:
      first - The first element
      second - The second element
  • Method Details

    • getFirst

      public F getFirst()
      Description copied from interface: IDyad
      Get the first element
      Specified by:
      getFirst in interface IDyad<F,​S>
      Returns:
      The first element
    • getSecond

      public S getSecond()
      Description copied from interface: IDyad
      Get the second element
      Specified by:
      getSecond in interface IDyad<F,​S>
      Returns:
      The second element