|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectIntegerBag
public class IntegerBag
Objects of the class IntegerBag are simple
representations of a set of integers supporting some basic
mathematical operations (min, max, sum, and product).
| Constructor Summary | |
|---|---|
IntegerBag(java.lang.Integer[] numbers)
Creates a new IntegerBag instance having the
(non-null) integers in the given array in the bag |
|
| Method Summary | |
|---|---|
java.lang.Integer |
max()
Calculate the largest number in this bag according to Integer.compareTo |
java.lang.Integer |
min()
Calculate the smallest number in this bag according to Integer.compareTo |
java.lang.Integer |
product()
Calculate the product of the numbers in this bag. |
int |
size()
Number of integers in this bag. |
java.lang.Integer |
sum()
Calculate the sum of the numbers in this bag. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IntegerBag(java.lang.Integer[] numbers)
IntegerBag instance having the
(non-null) integers in the given array in the bag
numbers - Array of values to include in the bag| Method Detail |
|---|
public int size()
public java.lang.Integer max()
java.lang.IllegalStateException - if there are no numberspublic java.lang.Integer min()
java.lang.IllegalStateException - if there are no numberspublic java.lang.Integer sum()
public java.lang.Integer product()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||