RobotCore
1.0
WPILib port to raspberry Pi
Toggle main menu visibility
Loading...
Searching...
No Matches
Pair.java
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
package
org.wpilib.util;
6
7
import
java.util.Objects;
8
15
public
class
Pair
<A, B> {
16
private
final
A m_first;
17
private
final
B m_second;
18
25
public
Pair
(A first, B second) {
26
m_first = first;
27
m_second = second;
28
}
29
35
public
A
getFirst
() {
36
return
m_first;
37
}
38
44
public
B
getSecond
() {
45
return
m_second;
46
}
47
57
public
static <A, B>
Pair<A, B>
of
(A a, B b) {
58
return
new
Pair<>
(a, b);
59
}
60
61
@Override
62
public
String toString() {
63
return
String.format(
"Pair(%s, %s)"
, m_first, m_second);
64
}
65
72
@Override
73
public
boolean
equals
(Object obj) {
74
return
obj ==
this
75
|| obj instanceof
Pair<?, ?>
other
76
&& Objects.equals(m_first, other.getFirst())
77
&& Objects.equals(m_second, other.getSecond());
78
}
79
80
@Override
81
public
int
hashCode() {
82
return
Objects.hash(m_first, m_second);
83
}
84
}
org.wpilib.util.Pair.getFirst
A getFirst()
Definition
Pair.java:35
org.wpilib.util.Pair.Pair
Pair(A first, B second)
Definition
Pair.java:25
org.wpilib.util.Pair.equals
boolean equals(Object obj)
Definition
Pair.java:73
org.wpilib.util.Pair.of
static< A, B > Pair< A, B > of(A a, B b)
Definition
Pair.java:57
org.wpilib.util.Pair.getSecond
B getSecond()
Definition
Pair.java:44
org
wpilib
util
Pair.java
Generated by
1.18.0