java set 排序的_java set集合排序

package com.unionpaysmart.boss.model.dto.iface;

import java.io.Serializable;

import java.util.Set;

import com.unionpaysmart.boss.orm.domain.trans.sys.SysInterface;

/**

* @author yida

* @date 2015年5月18日 下午8:30:28

*/

public class IfaceDto implements Serializable, Comparable {

private static final long serialVersionUID = 6808646640186815222L;

protected Integer id;// sys_interface Id

protected String ifCode;

protected String description;

protected String ifCodeCh;

protected String uri;

protected Boolean checked;

protected Set ifaceCategorys;

@Override

public int compareTo(IfaceDto ifaceDto) {

if (this == ifaceDto) {

return 0;

} else if (ifaceDto != null) {

IfaceDto u = ifaceDto;

if (id <= u.id) {

return -1;

} else {

return 1;

}

} else {

return -1;

}

}

public IfaceDto() {

super();

}

public IfaceDto(SysInterface sysInterface) {

super();

if (null != sysInterface) {

this.id = sysInterface.getId();

this.ifCode = sysInterface.getIfCode();

this.description = sysInterface.getDescription();

this.ifCodeCh = sysInterface.getIfCodeCh();

this.uri = sysInterface.getUri();

}

}

public Boolean getChecked() {

return checked;

}

public void setChecked(Boolean checked) {

this.checked = checked;

}

public Integer getId() {

return id;

}

public void setId(Integer id) {

this.id = id;

}

public String getIfCode() {

return ifCode;

}

public void setIfCode(String ifCode) {

this.ifCode = ifCode;

}

public String getDescription() {

return description;

}

public void setDescription(String description) {

this.description = description;

}

public String getIfCodeCh() {

return ifCodeCh;

}

public void setIfCodeCh(String ifCodeCh) {

this.ifCodeCh = ifCodeCh;

}

public String getUri() {

return uri;

}

public void setUri(String uri) {

this.uri = uri;

}

public Set getIfaceCategorys() {

return ifaceCategorys;

}

public void setIfaceCategorys(Set ifaceCategorys) {

this.ifaceCategorys = ifaceCategorys;

}

@Override

public String toString() {

return "IfaceDto [id=" + id + ", ifCode=" + ifCode + ", description=" + description + ", ifCodeCh=" + ifCodeCh + ", uri=" + uri + ", checked=" + checked + "]";

}

}

Set ifaceDtos = new TreeSet();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值