Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public final class Route implements Comparable<Route>{
- private final String startPoint;
- private final String endPoint;
- private final int number;
- public Route(String startPoint, String endPoint, int nomber) {
- this.startPoint = startPoint;
- this.endPoint = endPoint;
- this.number = nomber;
- }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Route route = (Route) o;
- return number == route.number &&
- startPoint.equals(route.startPoint) &&
- endPoint.equals(route.endPoint);
- }
- @Override
- public int hashCode() {
- return Objects.hash(startPoint, endPoint, number);
- }
- public String getStartPoint() {
- return startPoint;
- }
- public String getEndPoint() {
- return endPoint;
- }
- public int getNumber() {
- return number;
- }
- @Override
- public int compareTo(Route route) {
- return Integer.compare(number, route.number);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement