/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, * 2, 1}. The returned list is backed by this list, so changes in the returned * list are reflected in this list, and vice-versa. The returned list supports * all of the optional list operations supported by this list. * * <p>The returned list is random-access if the specified list is random * access. * * @since 7.0 */ @CheckReturnValue public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<T>(list); } else { return new ReverseList<T>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, * 2, 1}. The returned list is backed by this list, so changes in the returned * list are reflected in this list, and vice-versa. The returned list supports * all of the optional list operations supported by this list. * * <p>The returned list is random-access if the specified list is random * access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<T>(list); } else { return new ReverseList<T>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, * 2, 1}. The returned list is backed by this list, so changes in the returned * list are reflected in this list, and vice-versa. The returned list supports * all of the optional list operations supported by this list. * * <p>The returned list is random-access if the specified list is random * access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<T>(list); } else { return new ReverseList<T>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, * 2, 1}. The returned list is backed by this list, so changes in the returned * list are reflected in this list, and vice-versa. The returned list supports * all of the optional list operations supported by this list. * * <p>The returned list is random-access if the specified list is random * access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<T>(list); } else { return new ReverseList<T>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, * 2, 1}. The returned list is backed by this list, so changes in the returned * list are reflected in this list, and vice-versa. The returned list supports * all of the optional list operations supported by this list. * * <p>The returned list is random-access if the specified list is random * access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<T>(list); } else { return new ReverseList<T>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, * 2, 1}. The returned list is backed by this list, so changes in the returned * list are reflected in this list, and vice-versa. The returned list supports * all of the optional list operations supported by this list. * * <p>The returned list is random-access if the specified list is random * access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<T>(list); } else { return new ReverseList<T>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, 2, 1}. The returned * list is backed by this list, so changes in the returned list are reflected in this list, and * vice-versa. The returned list supports all of the optional list operations supported by this * list. * * <p>The returned list is random-access if the specified list is random access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<>(list); } else { return new ReverseList<>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, * 2, 1}. The returned list is backed by this list, so changes in the returned * list are reflected in this list, and vice-versa. The returned list supports * all of the optional list operations supported by this list. * * <p>The returned list is random-access if the specified list is random * access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<T>(list); } else { return new ReverseList<T>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, * 2, 1}. The returned list is backed by this list, so changes in the returned * list are reflected in this list, and vice-versa. The returned list supports * all of the optional list operations supported by this list. * * <p>The returned list is random-access if the specified list is random * access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<T>(list); } else { return new ReverseList<T>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, 2, 1}. The returned * list is backed by this list, so changes in the returned list are reflected in this list, and * vice-versa. The returned list supports all of the optional list operations supported by this * list. * * <p>The returned list is random-access if the specified list is random access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<>(list); } else { return new ReverseList<>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, * 2, 1}. The returned list is backed by this list, so changes in the returned * list are reflected in this list, and vice-versa. The returned list supports * all of the optional list operations supported by this list. * * <p>The returned list is random-access if the specified list is random * access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<T>(list); } else { return new ReverseList<T>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, * 2, 1}. The returned list is backed by this list, so changes in the returned * list are reflected in this list, and vice-versa. The returned list supports * all of the optional list operations supported by this list. * * <p>The returned list is random-access if the specified list is random * access. * * @since 7 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<T>(list); } else { return new ReverseList<T>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, 2, 1}. The returned * list is backed by this list, so changes in the returned list are reflected in this list, and * vice-versa. The returned list supports all of the optional list operations supported by this * list. * * <p>The returned list is random-access if the specified list is random access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<>(list); } else { return new ReverseList<>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, 2, 1}. The returned * list is backed by this list, so changes in the returned list are reflected in this list, and * vice-versa. The returned list supports all of the optional list operations supported by this * list. * * <p>The returned list is random-access if the specified list is random access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<>(list); } else { return new ReverseList<>(list); } }
/** * Returns a reversed view of the specified list. For example, {@code * Lists.reverse(Arrays.asList(1, 2, 3))} returns a list containing {@code 3, 2, 1}. The returned * list is backed by this list, so changes in the returned list are reflected in this list, and * vice-versa. The returned list supports all of the optional list operations supported by this * list. * * <p>The returned list is random-access if the specified list is random access. * * @since 7.0 */ public static <T> List<T> reverse(List<T> list) { if (list instanceof ImmutableList) { return ((ImmutableList<T>) list).reverse(); } else if (list instanceof ReverseList) { return ((ReverseList<T>) list).getForwardList(); } else if (list instanceof RandomAccess) { return new RandomAccessReverseList<>(list); } else { return new ReverseList<>(list); } }