added nicer toString() for int ranges

This commit is contained in:
James Strachan
2012-07-25 05:59:01 -04:00
parent 559cfe29c8
commit fc4a7cd4dd
+9
View File
@@ -30,6 +30,15 @@ public final class IntRange implements Range<Integer>, IntIterable {
this.count = count; this.count = count;
} }
@Override
public String toString() {
if (count >= 0) {
return "" + getStart() + ".upto(" + getEnd() + ")";
} else {
return "" + getStart() + ".downto(" + getEnd() + ")";
}
}
@Override @Override
public boolean contains(Integer item) { public boolean contains(Integer item) {
if (item == null) return false; if (item == null) return false;