我想通过BigDecimal排序一个ArrayList和对砖墙来临。我有一个类,看起来有点像这样:Java收藏排序BigDecimal
public class deal implements Comparable{
protected BigDecimal bdPrice;
protected int iQuantity;
protected String sDealType;
protected UUID dealUniqueID;
protected int dealID;
protected BigDecimal bdUnitPrice;
public deal(){
bdPrice = new BigDecimal("0");
bdUnitPrice = new BigDecimal("0");
iQuantity = 1;
sDealType = "Single item";
dealUniqueID = UUID.randomUUID();
dealID = 0;
}
private void setUnitPrice(){
this.bdUnitPrice = this.bdPrice.divide(new BigDecimal(this.iQuantity));
}
public BigDecimal compareTo(deal oDeal) {
// TODO Auto-generated method stub
return bdUnitPrice.compareTo(oDeal.getUnitPrice())
最后
以上就是冷酷棒球最近收集整理的关于java bigdecima_Java收藏排序BigDecimal的全部内容,更多相关java内容请搜索靠谱客的其他文章。
发表评论 取消回复