Inline redundant package-private method that wraps
Objects.requireNonNull()
This commit is contained in:
parent
8f121670d4
commit
e205e071bb
|
@ -91,7 +91,7 @@ public class FluentIterable<E> implements Iterable<E> {
|
||||||
* @throws NullPointerException if iterable is null
|
* @throws NullPointerException if iterable is null
|
||||||
*/
|
*/
|
||||||
public static <T> FluentIterable<T> of(final Iterable<T> iterable) {
|
public static <T> FluentIterable<T> of(final Iterable<T> iterable) {
|
||||||
IterableUtils.checkNotNull(iterable);
|
Objects.requireNonNull(iterable, "iterable");
|
||||||
if (iterable instanceof FluentIterable<?>) {
|
if (iterable instanceof FluentIterable<?>) {
|
||||||
return (FluentIterable<T>) iterable;
|
return (FluentIterable<T>) iterable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class IterableUtils {
|
||||||
* @throws NullPointerException if iterable is null
|
* @throws NullPointerException if iterable is null
|
||||||
*/
|
*/
|
||||||
public static <E> Iterable<E> boundedIterable(final Iterable<E> iterable, final long maxSize) {
|
public static <E> Iterable<E> boundedIterable(final Iterable<E> iterable, final long maxSize) {
|
||||||
checkNotNull(iterable);
|
Objects.requireNonNull(iterable, "iterable");
|
||||||
if (maxSize < 0) {
|
if (maxSize < 0) {
|
||||||
throw new IllegalArgumentException("MaxSize parameter must not be negative.");
|
throw new IllegalArgumentException("MaxSize parameter must not be negative.");
|
||||||
}
|
}
|
||||||
|
@ -219,16 +219,6 @@ public class IterableUtils {
|
||||||
return chainedIterable(new Iterable[] {a, b, c, d});
|
return chainedIterable(new Iterable[] {a, b, c, d});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fail-fast check for null arguments.
|
|
||||||
*
|
|
||||||
* @param iterable the iterable to check
|
|
||||||
* @throws NullPointerException if iterable is null
|
|
||||||
*/
|
|
||||||
static void checkNotNull(final Iterable<?> iterable) {
|
|
||||||
Objects.requireNonNull(iterable, "iterable");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fail-fast check for null arguments.
|
* Fail-fast check for null arguments.
|
||||||
*
|
*
|
||||||
|
@ -238,7 +228,7 @@ public class IterableUtils {
|
||||||
static void checkNotNull(final Iterable<?>... iterables) {
|
static void checkNotNull(final Iterable<?>... iterables) {
|
||||||
Objects.requireNonNull(iterables, "iterables");
|
Objects.requireNonNull(iterables, "iterables");
|
||||||
for (final Iterable<?> iterable : iterables) {
|
for (final Iterable<?> iterable : iterables) {
|
||||||
checkNotNull(iterable);
|
Objects.requireNonNull(iterable, "iterable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +399,7 @@ public class IterableUtils {
|
||||||
*/
|
*/
|
||||||
public static <E> Iterable<E> filteredIterable(final Iterable<E> iterable,
|
public static <E> Iterable<E> filteredIterable(final Iterable<E> iterable,
|
||||||
final Predicate<? super E> predicate) {
|
final Predicate<? super E> predicate) {
|
||||||
checkNotNull(iterable);
|
Objects.requireNonNull(iterable, "iterable");
|
||||||
Objects.requireNonNull(predicate, "predicate");
|
Objects.requireNonNull(predicate, "predicate");
|
||||||
return new FluentIterable<E>() {
|
return new FluentIterable<E>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -572,7 +562,7 @@ public class IterableUtils {
|
||||||
* @throws NullPointerException if iterable is null
|
* @throws NullPointerException if iterable is null
|
||||||
*/
|
*/
|
||||||
public static <E> Iterable<E> loopingIterable(final Iterable<E> iterable) {
|
public static <E> Iterable<E> loopingIterable(final Iterable<E> iterable) {
|
||||||
checkNotNull(iterable);
|
Objects.requireNonNull(iterable, "iterable");
|
||||||
return new FluentIterable<E>() {
|
return new FluentIterable<E>() {
|
||||||
@Override
|
@Override
|
||||||
public Iterator<E> iterator() {
|
public Iterator<E> iterator() {
|
||||||
|
@ -818,7 +808,7 @@ public class IterableUtils {
|
||||||
* @see ReverseListIterator
|
* @see ReverseListIterator
|
||||||
*/
|
*/
|
||||||
public static <E> Iterable<E> reversedIterable(final Iterable<E> iterable) {
|
public static <E> Iterable<E> reversedIterable(final Iterable<E> iterable) {
|
||||||
checkNotNull(iterable);
|
Objects.requireNonNull(iterable, "iterable");
|
||||||
return new FluentIterable<E>() {
|
return new FluentIterable<E>() {
|
||||||
@Override
|
@Override
|
||||||
public Iterator<E> iterator() {
|
public Iterator<E> iterator() {
|
||||||
|
@ -864,7 +854,7 @@ public class IterableUtils {
|
||||||
* @throws NullPointerException if iterable is null
|
* @throws NullPointerException if iterable is null
|
||||||
*/
|
*/
|
||||||
public static <E> Iterable<E> skippingIterable(final Iterable<E> iterable, final long elementsToSkip) {
|
public static <E> Iterable<E> skippingIterable(final Iterable<E> iterable, final long elementsToSkip) {
|
||||||
checkNotNull(iterable);
|
Objects.requireNonNull(iterable, "iterable");
|
||||||
if (elementsToSkip < 0) {
|
if (elementsToSkip < 0) {
|
||||||
throw new IllegalArgumentException("ElementsToSkip parameter must not be negative.");
|
throw new IllegalArgumentException("ElementsToSkip parameter must not be negative.");
|
||||||
}
|
}
|
||||||
|
@ -970,7 +960,7 @@ public class IterableUtils {
|
||||||
*/
|
*/
|
||||||
public static <I, O> Iterable<O> transformedIterable(final Iterable<I> iterable,
|
public static <I, O> Iterable<O> transformedIterable(final Iterable<I> iterable,
|
||||||
final Transformer<? super I, ? extends O> transformer) {
|
final Transformer<? super I, ? extends O> transformer) {
|
||||||
checkNotNull(iterable);
|
Objects.requireNonNull(iterable, "iterable");
|
||||||
Objects.requireNonNull(transformer, "transformer");
|
Objects.requireNonNull(transformer, "transformer");
|
||||||
return new FluentIterable<O>() {
|
return new FluentIterable<O>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -994,7 +984,7 @@ public class IterableUtils {
|
||||||
* @throws NullPointerException if iterable is null
|
* @throws NullPointerException if iterable is null
|
||||||
*/
|
*/
|
||||||
public static <E> Iterable<E> uniqueIterable(final Iterable<E> iterable) {
|
public static <E> Iterable<E> uniqueIterable(final Iterable<E> iterable) {
|
||||||
checkNotNull(iterable);
|
Objects.requireNonNull(iterable, "iterable");
|
||||||
return new FluentIterable<E>() {
|
return new FluentIterable<E>() {
|
||||||
@Override
|
@Override
|
||||||
public Iterator<E> iterator() {
|
public Iterator<E> iterator() {
|
||||||
|
@ -1015,7 +1005,7 @@ public class IterableUtils {
|
||||||
* @throws NullPointerException if iterable is null
|
* @throws NullPointerException if iterable is null
|
||||||
*/
|
*/
|
||||||
public static <E> Iterable<E> unmodifiableIterable(final Iterable<E> iterable) {
|
public static <E> Iterable<E> unmodifiableIterable(final Iterable<E> iterable) {
|
||||||
checkNotNull(iterable);
|
Objects.requireNonNull(iterable, "iterable");
|
||||||
if (iterable instanceof UnmodifiableIterable<?>) {
|
if (iterable instanceof UnmodifiableIterable<?>) {
|
||||||
return iterable;
|
return iterable;
|
||||||
}
|
}
|
||||||
|
@ -1042,8 +1032,8 @@ public class IterableUtils {
|
||||||
*/
|
*/
|
||||||
public static <E> Iterable<E> zippingIterable(final Iterable<? extends E> a,
|
public static <E> Iterable<E> zippingIterable(final Iterable<? extends E> a,
|
||||||
final Iterable<? extends E> b) {
|
final Iterable<? extends E> b) {
|
||||||
checkNotNull(a);
|
Objects.requireNonNull(a, "iterable");
|
||||||
checkNotNull(b);
|
Objects.requireNonNull(b, "iterable");
|
||||||
return new FluentIterable<E>() {
|
return new FluentIterable<E>() {
|
||||||
@Override
|
@Override
|
||||||
public Iterator<E> iterator() {
|
public Iterator<E> iterator() {
|
||||||
|
@ -1069,7 +1059,7 @@ public class IterableUtils {
|
||||||
* @throws NullPointerException if either of the provided iterables is null
|
* @throws NullPointerException if either of the provided iterables is null
|
||||||
*/
|
*/
|
||||||
public static <E> Iterable<E> zippingIterable(final Iterable<? extends E> first, final Iterable<? extends E>... others) {
|
public static <E> Iterable<E> zippingIterable(final Iterable<? extends E> first, final Iterable<? extends E>... others) {
|
||||||
checkNotNull(first);
|
Objects.requireNonNull(first, "iterable");
|
||||||
checkNotNull(others);
|
checkNotNull(others);
|
||||||
return new FluentIterable<E>() {
|
return new FluentIterable<E>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue