Package ghidra.util.datastruct
Class Duo<T>
java.lang.Object
ghidra.util.datastruct.Duo<T>
- Type Parameters:
T
- The type of item that is stored in this Duo.
Class for holding two objects of the same type. We are using the idiom of LEFT and RIGHT to
refer to each item in this pair of objects.
The enum "Side" is used to represent either the LEFT (or first) or RIGHT (or second) item.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Invokes the given consumer on both the left and right values.boolean
boolean
Returns true if both values are equals to this objects values.Gets the value for the given side.int
hashCode()
Creates a new Duo, replacing the value for just one side.
-
Constructor Details
-
Duo
public Duo()Constructor with no values. -
Duo
Constructor with a left and right value.- Parameters:
left
- the left valueright
- the right value
-
-
Method Details
-
get
Gets the value for the given side.- Parameters:
side
- LEFT or RIGHT- Returns:
- the value for the given side
-
with
Creates a new Duo, replacing the value for just one side. The other side uses the value from this Duo.- Parameters:
side
- the side that gets a new valuenewValue
- the new value for the given side- Returns:
- the new Duo value as this
-
each
Invokes the given consumer on both the left and right values.- Parameters:
c
- the consumer to invoke on both values
-
equals
Returns true if both values are equals to this objects values.- Parameters:
otherLeft
- the value to compare to our left side valueotherRight
- the value to compare to our right side value- Returns:
- true if both values are equals to this objects values
-
hashCode
public int hashCode() -
equals
-