Rearranged methods to follow common structure.
This commit is contained in:
@@ -79,6 +79,13 @@ public final class ByteRange implements Range<Byte>, ByteIterable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public ByteIterator step(int step) {
|
||||
if (step < 0)
|
||||
return new ByteIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new ByteIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
public boolean getIsReversed() {
|
||||
return count < 0;
|
||||
}
|
||||
@@ -95,13 +102,6 @@ public final class ByteRange implements Range<Byte>, ByteIterable {
|
||||
return count < 0 ? -count : count;
|
||||
}
|
||||
|
||||
public ByteIterator step(int step) {
|
||||
if (step < 0)
|
||||
return new ByteIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new ByteIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteIterator iterator() {
|
||||
return new ByteIteratorImpl(start, count, 1);
|
||||
|
||||
@@ -79,6 +79,13 @@ public final class CharRange implements Range<Character>, CharIterable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public CharIterator step(int step) {
|
||||
if (step < 0)
|
||||
return new CharIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new CharIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
public boolean getIsReversed() {
|
||||
return count < 0;
|
||||
}
|
||||
@@ -95,13 +102,6 @@ public final class CharRange implements Range<Character>, CharIterable {
|
||||
return count < 0 ? -count : count;
|
||||
}
|
||||
|
||||
public CharIterator step(int step) {
|
||||
if (step < 0)
|
||||
return new CharIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new CharIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharIterator iterator() {
|
||||
return new CharIteratorImpl(start, count, 1);
|
||||
|
||||
@@ -44,13 +44,6 @@ public final class LongRange implements Range<Long>, LongIterable {
|
||||
}
|
||||
|
||||
|
||||
public LongIterator step(long step) {
|
||||
if (step < 0)
|
||||
return new LongIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new LongIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Long item) {
|
||||
if (item == null) return false;
|
||||
@@ -87,6 +80,13 @@ public final class LongRange implements Range<Long>, LongIterable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public LongIterator step(long step) {
|
||||
if (step < 0)
|
||||
return new LongIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new LongIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
public boolean getIsReversed() {
|
||||
return count < 0;
|
||||
}
|
||||
|
||||
@@ -43,13 +43,6 @@ public final class ShortRange implements Range<Short>, ShortIterable {
|
||||
}
|
||||
}
|
||||
|
||||
public ShortIterator step(int step) {
|
||||
if (step < 0)
|
||||
return new ShortIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new ShortIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Short item) {
|
||||
if (item == null) return false;
|
||||
@@ -86,6 +79,13 @@ public final class ShortRange implements Range<Short>, ShortIterable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public ShortIterator step(int step) {
|
||||
if (step < 0)
|
||||
return new ShortIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new ShortIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
public boolean getIsReversed() {
|
||||
return count < 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user