Class Pair<F,​S>

  • Type Parameters:
    F - type of first value
    S - type of second value

    public class Pair<F,​S>
    extends Object
    A simple class to type-safely model a pair of values.
    • Field Detail

      • and

        public static final Pair.And and
        and is a "binding" constant that enables clean syntax for creating pairs:
        Pair<String,Integer> pair = "Moe" and 88;

        Use with Map#mapOf extension method via manifold-collections dependency.
        Map<String,Integer> map = Map.mapOf("Moe" and 77, "Larry" and 88, "Curly" and 99);
    • Constructor Detail

      • Pair

        public Pair​(F first,
                    S second)
    • Method Detail

      • getFirst

        public F getFirst()
      • getSecond

        public S getSecond()
      • make

        public static <T,​V> Pair<T,​V> make​(T f,
                                                       V s)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object