Class LongDoublePair

  • All Implemented Interfaces:
    Tuple, java.io.Serializable, java.lang.Comparable<LongDoublePair>, Bean, ImmutableBean

    public final class LongDoublePair
    extends java.lang.Object
    implements ImmutableBean, Tuple, java.lang.Comparable<LongDoublePair>, java.io.Serializable
    An immutable pair consisting of a long and double.

    This class is similar to Pair but is based on two primitive elements.

    This class is immutable and thread-safe.

    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  LongDoublePair.Meta
      The meta-bean for LongDoublePair.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(LongDoublePair other)
      Compares the pair based on the first element followed by the second element.
      com.google.common.collect.ImmutableList<java.lang.Object> elements()
      Gets the elements from this pair as a list.
      boolean equals​(java.lang.Object obj)  
      long getFirst()
      Gets the first element in this pair.
      double getSecond()
      Gets the second element in this pair.
      int hashCode()  
      static LongDoublePair.Meta meta()
      The meta-bean for LongDoublePair.
      LongDoublePair.Meta metaBean()  
      static LongDoublePair of​(long first, double second)
      Obtains an instance from a long and a double.
      static LongDoublePair ofPair​(Pair<java.lang.Long,​java.lang.Double> pair)
      Obtains an instance from a Pair.
      static LongDoublePair parse​(java.lang.String pairStr)
      Parses a LongDoublePair from the standard string format.
      int size()
      Gets the number of elements held by this pair.
      Pair<java.lang.Long,​java.lang.Double> toPair()
      Converts this pair to an object-based Pair.
      java.lang.String toString()
      Gets the pair using a standard string format.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • of

        public static LongDoublePair of​(long first,
                                        double second)
        Obtains an instance from a long and a double.
        Parameters:
        first - the first element
        second - the second element
        Returns:
        a pair formed from the two parameters
      • ofPair

        public static LongDoublePair ofPair​(Pair<java.lang.Long,​java.lang.Double> pair)
        Obtains an instance from a Pair.
        Parameters:
        pair - the pair to convert
        Returns:
        a pair formed by extracting values from the pair
      • parse

        public static LongDoublePair parse​(java.lang.String pairStr)
        Parses a LongDoublePair from the standard string format.

        The standard format is '[$first, $second]'. Spaces around the values are trimmed.

        Parameters:
        pairStr - the text to parse
        Returns:
        the parsed pair
        Throws:
        java.lang.IllegalArgumentException - if the pair cannot be parsed
      • size

        public int size()
        Gets the number of elements held by this pair.
        Specified by:
        size in interface Tuple
        Returns:
        size 2
      • elements

        public com.google.common.collect.ImmutableList<java.lang.Object> elements()
        Gets the elements from this pair as a list.

        The list returns each element in the pair in order.

        Specified by:
        elements in interface Tuple
        Returns:
        the elements as an immutable list
      • toPair

        public Pair<java.lang.Long,​java.lang.Double> toPair()
        Converts this pair to an object-based Pair.
        Returns:
        the object-based pair
      • compareTo

        public int compareTo​(LongDoublePair other)
        Compares the pair based on the first element followed by the second element.

        This compares the first elements, then the second elements.

        Specified by:
        compareTo in interface java.lang.Comparable<LongDoublePair>
        Parameters:
        other - the other pair
        Returns:
        negative if this is less, zero if equal, positive if greater
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Gets the pair using a standard string format.

        The standard format is '[$first, $second]'. Spaces around the values are trimmed.

        Overrides:
        toString in class java.lang.Object
        Returns:
        the pair as a string
      • meta

        public static LongDoublePair.Meta meta()
        The meta-bean for LongDoublePair.
        Returns:
        the meta-bean, not null
      • getFirst

        public long getFirst()
        Gets the first element in this pair.
        Returns:
        the value of the property
      • getSecond

        public double getSecond()
        Gets the second element in this pair.
        Returns:
        the value of the property