• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

我手牌的排序一直不成功,谁帮我看看问题出在哪儿

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

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与1

playerMap.get(1)、playerMap.get(2)这个有问题,应该是0和1,也就是:playerMap.get(0),playerMap.get(1)

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!