Package it.unimi.di.prog2.h23
Class ListUtils.PositiveIntBox
java.lang.Object
it.unimi.di.prog2.h23.ListUtils.PositiveIntBox
- All Implemented Interfaces:
Comparable<ListUtils.PositiveIntBox>
- Direct Known Subclasses:
ListUtils.AbsoluteValueIntBox
- Enclosing class:
ListUtils
public static class ListUtils.PositiveIntBox
extends Object
implements Comparable<ListUtils.PositiveIntBox>
A box containing a positive integer.
-
Field Details
-
value
private final int valueThe value in the box.
-
-
Constructor Details
-
PositiveIntBox
public PositiveIntBox(int value) Creates a new box containing a positive integer.- Parameters:
value
- the value.- Throws:
IllegalArgumentException
- ifvalue
is not positive.
-
-
Method Details
-
value
public int value()Returns the value in the box.- Returns:
- the value in the box.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ListUtils.PositiveIntBox>
-
toString
-