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 beSerializable
S
- 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.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:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Reveals whether an object is equal to thisPair
instance.F
getFirst()
Gets the first object of the pair.S
getSecond()
Gets the second object of the pair.int
hashCode()
Returns a hash code of the currentPair
by using the first and second object.void
setFirst(F first)
Sets the first object, which must be of thePair
type.void
setSecond(S second)
Sets the first object, which must be of thePair
type.java.lang.String
toString()
Returns a string representation of the currentPair
.
-
-
-
Method Detail
-
setFirst
public void setFirst(F first)
Sets the first object, which must be of thePair
type.- Parameters:
first
- the new first object of the pair
-
setSecond
public void setSecond(S second)
Sets the first object, which must be of thePair
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 java.lang.String toString()
Returns a string representation of the currentPair
.The string representation will look like this:
{firstObject.toString(), secondObject.toString()}
- Overrides:
toString
in 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 thisPair
instance.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object to compare with thisPair
instance- Returns:
- whether an object is equal to this
Pair
instance
-
hashCode
public int hashCode()
Returns a hash code of the currentPair
by using the first and second object.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code of the current
Pair
-
-