Class Pair<F extends java.io.Serializable,S extends java.io.Serializable>
- java.lang.Object
-
- org.schabi.newpipe.extractor.utils.Pair<F,S>
-
- Type Parameters:
F- the type of the first object, which must beSerializableS- the type of the second object, which must beSerializable
- All Implemented Interfaces:
java.io.Serializable
public class Pair<F extends java.io.Serializable,S extends java.io.Serializable> extends java.lang.Object implements java.io.SerializableSerializable class to create a pair of objects.The two objects of the pair must be
serializableand 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:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Reveals whether an object is equal to thisPairinstance.FgetFirst()Gets the first object of the pair.SgetSecond()Gets the second object of the pair.inthashCode()Returns a hash code of the currentPairby using the first and second object.voidsetFirst(F first)Sets the first object, which must be of thePairtype.voidsetSecond(S second)Sets the first object, which must be of thePairtype.java.lang.StringtoString()Returns a string representation of the currentPair.
-
-
-
Method Detail
-
setFirst
public void setFirst(F first)
Sets the first object, which must be of thePairtype.- Parameters:
first- the new first object of the pair
-
setSecond
public void setSecond(S second)
Sets the first object, which must be of thePairtype.- 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 java.lang.String toString()
Returns a string representation of the currentPair.The string representation will look like this:
{firstObject.toString(), secondObject.toString()}- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of the current
Pair
-
equals
public boolean equals(java.lang.Object obj)
Reveals whether an object is equal to thisPairinstance.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare with thisPairinstance- Returns:
- whether an object is equal to this
Pairinstance
-
hashCode
public int hashCode()
Returns a hash code of the currentPairby using the first and second object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code of the current
Pair
-
-