/** * Creates an immutable list that consists of the given elements. This method should only be used in the varargs form. If there is a need to create * an immutable list of an array of elements, {@link #copyOf(Object[])} should be used instead. * * @param elements the given elements * @return an immutable list */ @SafeVarargs public static <T> List<T> of(T... elements) { Preconditions.checkNotNull(elements); return ofInternal(elements); }
/** * Creates an immutable list that consists of the given elements. This method should only be used in the varargs form. If there is a need to create * an immutable list of an array of elements, {@link #copyOf(Object[])} should be used instead. * * @param elements the given elements * @return an immutable list */ @SafeVarargs public static <T> List<T> of(T... elements) { Preconditions.checkNotNull(elements); return ofInternal(elements); }
/** * Creates an immutable list that consists of the given elements. This method should only be used in the varargs form. If there is a need to create an * immutable list of an array of elements, {@link #copyOf(Object[])} should be used instead. * * @param elements the given elements * @return an immutable list */ @SafeVarargs public static <T> List<T> of(T... elements) { Preconditions.checkNotNull(elements); return ofInternal(elements); }
/** * Creates an immutable list that consists of the given elements. This method should only be used in the varargs form. If there is a need to create * an immutable list of an array of elements, {@link #copyOf(Object[])} should be used instead. * * @param elements the given elements * @return an immutable list */ @SafeVarargs public static <T> List<T> of(T... elements) { Preconditions.checkNotNull(elements); return ofInternal(elements); }
/** * Creates an immutable list that consists of the given elements. This method should only be used in the varargs form. If there is a need to create * an immutable list of an array of elements, {@link #copyOf(Object[])} should be used instead. * * @param elements the given elements * @return an immutable list */ @SafeVarargs public static <T> List<T> of(T... elements) { Preconditions.checkNotNull(elements); return ofInternal(elements); }
/** * Creates an immutable list that consists of the given elements. This method should only be used in the varargs form. If there is a need to create * an immutable list of an array of elements, {@link #copyOf(Object[])} should be used instead. * * @param elements the given elements * @return an immutable list */ @SafeVarargs public static <T> List<T> of(T... elements) { Preconditions.checkNotNull(elements); return ofInternal(elements); }
/** * Creates an immutable list that consists of the elements in the given collection. If the given collection is already an immutable list, * it is returned directly. * * @param source the given collection * @return an immutable list */ public static <T> List<T> copyOf(Collection<T> source) { Preconditions.checkNotNull(source); if (source instanceof ImmutableList<?>) { return (ImmutableList<T>) source; } if (source.isEmpty()) { return Collections.emptyList(); } return ofInternal(source.toArray()); }
/** * Creates an immutable list that consists of the elements in the given collection. If the given collection is already an immutable list, * it is returned directly. * * @param source the given collection * @return an immutable list */ public static <T> List<T> copyOf(Collection<T> source) { Preconditions.checkNotNull(source); if (source instanceof ImmutableList<?>) { return (ImmutableList<T>) source; } if (source.isEmpty()) { return Collections.emptyList(); } return ofInternal(source.toArray()); }
/** * Creates an immutable list that consists of the elements in the given collection. If the given collection is already an immutable list, it is returned * directly. * * @param source the given collection * @return an immutable list */ public static <T> List<T> copyOf(Collection<T> source) { Preconditions.checkNotNull(source); if (source instanceof ImmutableList<?>) { return (ImmutableList<T>) source; } if (source.isEmpty()) { return Collections.emptyList(); } return ofInternal(source.toArray()); }
/** * Creates an immutable list that consists of the elements in the given collection. If the given collection is already an immutable list, * it is returned directly. * * @param source the given collection * @return an immutable list */ public static <T> List<T> copyOf(Collection<T> source) { Preconditions.checkNotNull(source); if (source instanceof ImmutableList<?>) { return (ImmutableList<T>) source; } if (source.isEmpty()) { return Collections.emptyList(); } return ofInternal(source.toArray()); }
/** * Creates an immutable list that consists of the elements in the given collection. If the given collection is already an immutable list, * it is returned directly. * * @param source the given collection * @return an immutable list */ public static <T> List<T> copyOf(Collection<T> source) { Preconditions.checkNotNull(source); if (source instanceof ImmutableList<?>) { return (ImmutableList<T>) source; } if (source.isEmpty()) { return Collections.emptyList(); } return ofInternal(source.toArray()); }
/** * Creates an immutable list that consists of the elements in the given collection. If the given collection is already an immutable list, * it is returned directly. * * @param source the given collection * @return an immutable list */ public static <T> List<T> copyOf(Collection<T> source) { Preconditions.checkNotNull(source); if (source instanceof ImmutableList<?>) { return (ImmutableList<T>) source; } if (source.isEmpty()) { return Collections.emptyList(); } return ofInternal(source.toArray()); }
/** * Creates an immutable list that consists of the elements in the given array. A copy of the given array is used which means * that any modifications to the given array will not affect the immutable list. * * @param elements the given array of elements * @return an immutable list */ public static <T> List<T> copyOf(T[] elements) { Preconditions.checkNotNull(elements); return ofInternal(elements.clone()); }
/** * Creates an immutable list that consists of the elements in the given array. A copy of the given array is used which means * that any modifications to the given array will not affect the immutable list. * * @param elements the given array of elements * @return an immutable list */ public static <T> List<T> copyOf(T[] elements) { Preconditions.checkNotNull(elements); return ofInternal(elements.clone()); }
/** * Creates an immutable list that consists of the elements in the given array. A copy of the given array is used which means that any modifications to the * given array will not affect the immutable list. * * @param elements the given array of elements * @return an immutable list */ public static <T> List<T> copyOf(T[] elements) { Preconditions.checkNotNull(elements); return ofInternal(elements.clone()); }
/** * Creates an immutable list that consists of the elements in the given array. A copy of the given array is used which means * that any modifications to the given array will not affect the immutable list. * * @param elements the given array of elements * @return an immutable list */ public static <T> List<T> copyOf(T[] elements) { Preconditions.checkNotNull(elements); return ofInternal(elements.clone()); }
/** * Creates an immutable list that consists of the elements in the given array. A copy of the given array is used which means * that any modifications to the given array will not affect the immutable list. * * @param elements the given array of elements * @return an immutable list */ public static <T> List<T> copyOf(T[] elements) { Preconditions.checkNotNull(elements); return ofInternal(elements.clone()); }
/** * Creates an immutable list that consists of the elements in the given array. A copy of the given array is used which means * that any modifications to the given array will not affect the immutable list. * * @param elements the given array of elements * @return an immutable list */ public static <T> List<T> copyOf(T[] elements) { Preconditions.checkNotNull(elements); return ofInternal(elements.clone()); }