not me......I've got a final to study for and takewalker111 wrote:hrmmm, me you and clitz should havie a whore fest after lunch!
The OT place for OGs to BS w/o BS.
-
- Banjo Viking
- Posts: 6268
- Joined: May 11th, 2003, 1:54 pm
- Location: Where rock is criminal......criminals rock!
import java.util.*;walker111 wrote:poops! What class?Erik95LS wrote:not me......I've got a final to study for and takewalker111 wrote:hrmmm, me you and clitz should havie a whore fest after lunch!
public class Name implements Comparable<Name> {
private final String firstName, lastName;
public Name(String firstName, String lastName) {
if (firstName == null || lastName == null)
throw new NullPointerException();
this.firstName = firstName;
this.lastName = lastName;
}
public String firstName() { return firstName; }
public String lastName() { return lastName; }
public boolean equals(Object o) {
if (!(o instanceof Name))
return false;
Name n = (Name)o;
return n.firstName.equals(firstName) &&
n.lastName.equals(lastName);
}
public int hashCode() {
return 31*firstName.hashCode() + lastName.hashCode();
}
public String toString() {
return firstName + " " + lastName;
}
public int compareTo(Name n) {
int lastCmp = lastName.compareTo(n.lastName);
return (lastCmp != 0 ? lastCmp :
firstName.compareTo(n.firstName));
}
}
-Erik
"i sneezed and jam came out" - R-Box
"i sneezed and jam came out" - R-Box
uhhhh, ok!Erik95LS wrote:import java.util.*;walker111 wrote:poops! What class?Erik95LS wrote:not me......I've got a final to study for and takewalker111 wrote:hrmmm, me you and clitz should havie a whore fest after lunch!
public class Name implements Comparable<Name> {
private final String firstName, lastName;
public Name(String firstName, String lastName) {
if (firstName == null || lastName == null)
throw new NullPointerException();
this.firstName = firstName;
this.lastName = lastName;
}
public String firstName() { return firstName; }
public String lastName() { return lastName; }
public boolean equals(Object o) {
if (!(o instanceof Name))
return false;
Name n = (Name)o;
return n.firstName.equals(firstName) &&
n.lastName.equals(lastName);
}
public int hashCode() {
return 31*firstName.hashCode() + lastName.hashCode();
}
public String toString() {
return firstName + " " + lastName;
}
public int compareTo(Name n) {
int lastCmp = lastName.compareTo(n.lastName);
return (lastCmp != 0 ? lastCmp :
firstName.compareTo(n.firstName));
}
}
<praises that he joined the army instead of going to school But needs to go...