public class BalanceDecimal extends Object implements Iterator<BigDecimal>
| Modifier and Type | Method and Description |
|---|---|
BigDecimal |
get(int i) |
BigDecimal |
getPrecision() |
boolean |
hasNext() |
static void |
main(String[] args) |
BigDecimal |
next() |
static BalanceDecimal |
of(BigDecimal total,
List<BigDecimal> items)
balance the mumber with the count, and the scale is 2 (0.01)
20/6 = [3.33, 3.33, 3.34, 3.33, 3.33, 3.34]
|
static BalanceDecimal |
of(BigDecimal total,
List<BigDecimal> items,
int scale)
balance the mumber with the count, and the assigned scale
20/6 = [3.33, 3.33, 3.34, 3.33, 3.33, 3.34]
|
void |
remove() |
void |
reset() |
int |
scale() |
int |
size() |
BigDecimal |
total() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic static BalanceDecimal of(BigDecimal total, List<BigDecimal> items)
total - the number to be averageditems - the partpublic static BalanceDecimal of(BigDecimal total, List<BigDecimal> items, int scale)
total - the number to be averageditems - the partscale - the item's scalepublic boolean hasNext()
hasNext in interface Iterator<BigDecimal>public BigDecimal next()
next in interface Iterator<BigDecimal>public void remove()
remove in interface Iterator<BigDecimal>public void reset()
public BigDecimal get(int i)
public int size()
public BigDecimal total()
public int scale()
public BigDecimal getPrecision()
public static void main(String[] args)
Copyright © 2020. All rights reserved.