/** * Returns an immutable list of the elements between the specified {@code fromIndex}, inclusive, * and {@code toIndex}, exclusive. (If {@code fromIndex} and {@code toIndex} are equal, the empty * immutable list is returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; if (length == size()) { return this; } else if (length == 0) { return of(); } else if (length == 1) { return of(get(fromIndex)); } else { return subListUnchecked(fromIndex, toIndex); } }
/** * Returns an immutable list of the elements between the specified {@code fromIndex}, inclusive, * and {@code toIndex}, exclusive. (If {@code fromIndex} and {@code toIndex} are equal, the empty * immutable list is returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; if (length == size()) { return this; } else if (length == 0) { return of(); } else if (length == 1) { return of(get(fromIndex)); } else { return subListUnchecked(fromIndex, toIndex); } }
return of(); } else { return subListUnchecked(fromIndex, toIndex);
/** * Returns an immutable list of the elements between the specified {@code * fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code * fromIndex} and {@code toIndex} are equal, the empty immutable list is * returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; switch (length) { case 0: return of(); case 1: return of(get(fromIndex)); default: return subListUnchecked(fromIndex, toIndex); } }
/** * Returns an immutable list of the elements between the specified {@code * fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code * fromIndex} and {@code toIndex} are equal, the empty immutable list is * returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; switch (length) { case 0: return of(); case 1: return of(get(fromIndex)); default: return subListUnchecked(fromIndex, toIndex); } }
/** * Returns an immutable list of the elements between the specified {@code * fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code * fromIndex} and {@code toIndex} are equal, the empty immutable list is * returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; switch (length) { case 0: return of(); case 1: return of(get(fromIndex)); default: return subListUnchecked(fromIndex, toIndex); } }
/** * Returns an immutable list of the elements between the specified {@code * fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code * fromIndex} and {@code toIndex} are equal, the empty immutable list is * returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; switch (length) { case 0: return of(); case 1: return of(get(fromIndex)); default: return subListUnchecked(fromIndex, toIndex); } }
/** * Returns an immutable list of the elements between the specified {@code * fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code * fromIndex} and {@code toIndex} are equal, the empty immutable list is * returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; switch (length) { case 0: return of(); case 1: return of(get(fromIndex)); default: return subListUnchecked(fromIndex, toIndex); } }
/** * Returns an immutable list of the elements between the specified {@code * fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code * fromIndex} and {@code toIndex} are equal, the empty immutable list is * returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; switch (length) { case 0: return of(); case 1: return of(get(fromIndex)); default: return subListUnchecked(fromIndex, toIndex); } }
/** * Returns an immutable list of the elements between the specified {@code * fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code * fromIndex} and {@code toIndex} are equal, the empty immutable list is * returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; switch (length) { case 0: return of(); case 1: return of(get(fromIndex)); default: return subListUnchecked(fromIndex, toIndex); } }
/** * Returns an immutable list of the elements between the specified {@code fromIndex}, inclusive, * and {@code toIndex}, exclusive. (If {@code fromIndex} and {@code toIndex} are equal, the empty * immutable list is returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; if (length == size()) { return this; } else if (length == 0) { return of(); } else if (length == 1) { return of(get(fromIndex)); } else { return subListUnchecked(fromIndex, toIndex); } }
/** * Returns an immutable list of the elements between the specified {@code fromIndex}, inclusive, * and {@code toIndex}, exclusive. (If {@code fromIndex} and {@code toIndex} are equal, the empty * immutable list is returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; if (length == size()) { return this; } else if (length == 0) { return of(); } else if (length == 1) { return of(get(fromIndex)); } else { return subListUnchecked(fromIndex, toIndex); } }
/** * Returns an immutable list of the elements between the specified {@code * fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code * fromIndex} and {@code toIndex} are equal, the empty immutable list is * returned.) */ @Override public ImmutableList<E> subList(int fromIndex, int toIndex) { checkPositionIndexes(fromIndex, toIndex, size()); int length = toIndex - fromIndex; if (length == size()) { return this; } switch (length) { case 0: return of(); case 1: return of(get(fromIndex)); default: return subListUnchecked(fromIndex, toIndex); } }