Class Quadruple<A,​B,​C,​D>

  • Type Parameters:
    A - first object
    B - second object
    C - third object
    D - third object

    public class Quadruple<A,​B,​C,​D>
    extends Object
    Custom quadruple class.
    Author:
    markr
    • Field Detail

      • first

        protected final A first
        The first object
      • second

        protected final B second
        The second object
      • third

        protected final C third
        The third object
      • fourth

        protected final D fourth
        The fourth object
    • Constructor Detail

      • Quadruple

        protected Quadruple​(A first,
                            B second,
                            C third,
                            D fourth)
        Constructor
        Parameters:
        first - first object
        second - second object
        third - third object
        fourth - fourth object
    • Method Detail

      • of

        public static <A,​B,​C,​D> Quadruple<A,​B,​C,​D> of​(A valueA,
                                                                                          B valueB,
                                                                                          C valueC,
                                                                                          D valueD)
        Factory method
        Type Parameters:
        A - type of valueA
        B - type of valueB
        C - type of valueC
        D - type of valueD
        Parameters:
        valueA - first
        valueB - second
        valueC - first
        valueD - second
        Returns:
        new quadruple
      • copy

        public Quadruple<A,​B,​C,​D> copy()
        shallow copy of this pair
        Returns:
        shallow copy
      • first

        public A first()
        Get first object
        Returns:
        first object
      • second

        public B second()
        Get second object
        Returns:
        second object
      • third

        public C third()
        Get third object
        Returns:
        third object
      • fourth

        public D fourth()
        Get fourth object
        Returns:
        fourth object
      • anyIsNotNull

        public boolean anyIsNotNull()
        check if any of the values is not null
        Returns:
        true when one of the entries is not null
      • allNotNull

        public boolean allNotNull()
        check if all values are not null
        Returns:
        true when both entries are not null
      • anyIsNull

        public boolean anyIsNull()
        check if any values are null
        Returns:
        true when any are null, false otherwise
      • all

        public <T> void all​(Consumer<T> consumer)
        Apply consumer to all entries. Throws ClassCastException when pair contains entries not compatible with type parameter of consumer
        Type Parameters:
        T - consumer type assumed to be compatible with all entries
        Parameters:
        consumer - to apply