src/main/java/org/organicdesign/fp/collections/RangeOfInt.java
@Override public RangeOfInt subList(int fromIndex, int toIndex) {
        if ( (fromIndex == 0) && (toIndex == size) ) {
            return this;
        }
        // Note that this is an IllegalArgumentException, not IndexOutOfBoundsException in order to
        // match ArrayList.
        if (fromIndex > toIndex) {
            throw new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex +
                                               ")");
        }
        // The text of this matches ArrayList
        if (fromIndex < 0) {
            throw new IndexOutOfBoundsException("fromIndex = " + fromIndex);
        }
        if (toIndex > size) {
            throw new IndexOutOfBoundsException("toIndex = " + toIndex);
        }

        // Look very closely at the second parameter because the bounds checking is *different*
        // from the get() method.  get(toIndex) can throw an exception if toIndex >= start+size.
        // But since a range is exclusive of it's right-bound, we can create a new sub-range
        // with a right bound index of size, as opposed to size minus 1.  I spent hours
        // understanding this before fixing a bug with it.  In the end, subList should do the same
        // thing on a Range that it does on the equivalent ArrayList.  I made tests for the same.
        return RangeOfInt.of(start + fromIndex, start + toIndex);
    }
@Override public RangeOfInt subList(int fromIndex, int toIndex) {
        if ( (fromIndex == 0) && (toIndex == size) ) {
            return this;
        }
        // Note that this is an IllegalArgumentException, not IndexOutOfBoundsException in order to
        // match ArrayList.
        if (fromIndex > toIndex) {
            throw new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex +
                                               ")");
        }
        // The text of this matches ArrayList
        if (fromIndex < 0) {
            throw new IndexOutOfBoundsException("fromIndex = " + fromIndex);
        }
        if (toIndex > size) {
            throw new IndexOutOfBoundsException("toIndex = " + toIndex);
        }

        // Look very closely at the second parameter because the bounds checking is *different*
        // from the get() method.  get(toIndex) can throw an exception if toIndex >= start+size.
        // But since a range is exclusive of it's right-bound, we can create a new sub-range
        // with a right bound index of size, as opposed to size minus 1.  I spent hours
        // understanding this before fixing a bug with it.  In the end, subList should do the same
        // thing on a Range that it does on the equivalent ArrayList.  I made tests for the same.
        return RangeOfInt.of(start + fromIndex, start + toIndex);
    }
@ Override public RangeOfInt subList ( int fromIndex , int toIndex ) { if ( ( fromIndex == 0 ) && ( toIndex == size ) ) { return this ; } // Note that this is an IllegalArgumentException, not IndexOutOfBoundsException in order to // match ArrayList. if ( fromIndex > toIndex ) { throw new IllegalArgumentException ( "fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")" ) ; } // The text of this matches ArrayList if ( fromIndex < 0 ) { throw new IndexOutOfBoundsException ( "fromIndex = " + fromIndex ) ; } if ( toIndex > size ) { throw new IndexOutOfBoundsException ( "toIndex = " + toIndex ) ; } // Look very closely at the second parameter because the bounds checking is *different* // from the get() method.  get(toIndex) can throw an exception if toIndex >= start+size. // But since a range is exclusive of it's right-bound, we can create a new sub-range // with a right bound index of size, as opposed to size minus 1.  I spent hours // understanding this before fixing a bug with it.  In the end, subList should do the same // thing on a Range that it does on the equivalent ArrayList.  I made tests for the same. return RangeOfInt . of ( start + fromIndex , start + toIndex ) ; }
{@inheritDoc}
{