Site is now comparable.
This commit is contained in:
parent
1fb2b2408e
commit
200d47bb6a
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class Site {
|
||||
public class Site implements Comparable<Site> {
|
||||
|
||||
private String name;
|
||||
private List<String> roles;
|
||||
|
@ -44,4 +44,22 @@ public class Site {
|
|||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(Site o) {
|
||||
return getName().compareTo(o.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Site) {
|
||||
Site siteObj = (Site) obj;
|
||||
return getName().equals(siteObj.getName()) && getRoles().equals(siteObj.getRoles())
|
||||
&& getChildren().equals(siteObj.getChildren());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue