Class Pair<F extends Serializable,S extends Serializable>

java.lang.Object
org.schabi.newpipe.extractor.utils.Pair<F,S>
Type Parameters:
F - the type of the first object, which must be Serializable
S - the type of the second object, which must be Serializable
All Implemented Interfaces:
Serializable

public class Pair<F extends Serializable,S extends Serializable> extends Object implements Serializable
Serializable class to create a pair of objects.

The two objects of the pair must be serializable and can be of the same type.

Note that this class is not intended to be used as a general-purpose pair and should only be used when interfacing with the extractor.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Pair(F first, S second)
    Creates a new Pair object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Reveals whether an object is equal to this Pair instance.
    Gets the first object of the pair.
    Gets the second object of the pair.
    int
    Returns a hash code of the current Pair by using the first and second object.
    void
    setFirst(F first)
    Sets the first object, which must be of the Pair type.
    void
    setSecond(S second)
    Sets the first object, which must be of the Pair type.
    Returns a string representation of the current Pair.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Pair

      public Pair(F first, S second)
      Creates a new Pair object.
      Parameters:
      first - the first object of the pair
      second - the second object of the pair
  • Method Details

    • setFirst

      public void setFirst(F first)
      Sets the first object, which must be of the Pair type.
      Parameters:
      first - the new first object of the pair
    • setSecond

      public void setSecond(S second)
      Sets the first object, which must be of the Pair type.
      Parameters:
      second - the new first object of the pair
    • getFirst

      public F getFirst()
      Gets the first object of the pair.
      Returns:
      the first object of the pair
    • getSecond

      public S getSecond()
      Gets the second object of the pair.
      Returns:
      the second object of the pair
    • toString

      public String toString()
      Returns a string representation of the current Pair.

      The string representation will look like this: {firstObject.toString(), secondObject.toString()}

      Overrides:
      toString in class Object
      Returns:
      a string representation of the current Pair
    • equals

      public boolean equals(Object obj)
      Reveals whether an object is equal to this Pair instance.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare with this Pair instance
      Returns:
      whether an object is equal to this Pair instance
    • hashCode

      public int hashCode()
      Returns a hash code of the current Pair by using the first and second object.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code of the current Pair