Poker.javapackage com.wdp;public class Poker implements Comparable { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((ds == null) ? 0 : ds.hashCode()); result = prime * result + ((hs == null) ? 0 : hs.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Poker)) return false; Poker other = (Poker) obj; if (ds == null) { if (other.ds != null) return false; } else if (!ds.equals(other.ds)) return false; if (hs == null) { if (other.hs != null) return false; } else if (!hs.equals(other.hs)) return false; return true; } //扑克牌属性 private String hs; private String ds; //有参的构造方法 public Poker(String hs,String ds) { this.hs = hs; this.ds = ds; } //setter、getter public String getHs() { return hs; } public void setHs(String hs) { this.hs = hs; } public String getDs() { return ds; } public void setDs(String ds) { this.ds = ds; } @Override public int compareTo(Poker o) { // TODO Auto-generated method stub if(this.getValueOfDs()==o.getValueOfDs()){ return this.getValueOfHs()-o.getValueOfHs(); }else { return this.getValueOfDs()-o.getValueOfDs(); } } public int getValueOfHs() { String[] hs = {"黑桃","红桃","梅花","方片"}; for(int i=0;i |