Skip to content

Instantly share code, notes, and snippets.

@albow-net
Last active September 23, 2018 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albow-net/10ff258be338c2584e0cfddbdad44eb4 to your computer and use it in GitHub Desktop.
Save albow-net/10ff258be338c2584e0cfddbdad44eb4 to your computer and use it in GitHub Desktop.
jgrapht/Station.java
public class Station {
private final String name;
Station( String name ) {
this.name = name;
}
public String getName() {
return this.name;
}
@Override
public String toString() {
return "Station [name=" + name + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals( Object obj ) {
if ( this == obj ) return true;
if ( obj == null ) return false;
if ( getClass() != obj.getClass() ) return false;
Station other = (Station)obj;
if ( name == null ) {
if ( other.name != null ) return false;
} else if ( ! name.equals( other.name ) ) {
return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment