### ImmutableList Instance Methods Source: https://guava.dev/ImmutableList Instance methods available on an ImmutableList object. ```APIDOC ## ImmutableList.asList() ### Description Returns a view of this immutable list in reverse order. ### Method `ImmutableList asList()` ## ImmutableList.reverse() ### Description Returns a view of this immutable list in reverse order. ### Method `ImmutableList reverse()` ``` -------------------------------- ### ImmutableList Factory Methods Source: https://guava.dev/ImmutableList Static methods to create immutable list instances. ```APIDOC ## ImmutableList.of() ### Description Returns the empty immutable list. ### Method `static ImmutableList of()` ## ImmutableList.of(E e1) ### Description Returns an immutable list containing a single element. ### Method `static ImmutableList of(E e1)` ## ImmutableList.of(E e1, E e2) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2)` ## ImmutableList.of(E e1, E e2, E e3) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2, E e3)` ## ImmutableList.of(E e1, E e2, E e3, E e4) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2, E e3, E e4)` ## ImmutableList.of(E e1, E e2, E e3, E e4, E e5) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2, E e3, E e4, E e5)` ## ImmutableList.of(E e1, E e2, E e3, E e4, E e5, E e6) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6)` ## ImmutableList.of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7)` ## ImmutableList.of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8)` ## ImmutableList.of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9)` ## ImmutableList.of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10)` ## ImmutableList.of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11)` ## ImmutableList.of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... others) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... others)` ``` -------------------------------- ### ImmutableList Builder Methods Source: https://guava.dev/ImmutableList Methods for creating an ImmutableList.Builder to construct immutable lists. ```APIDOC ## ImmutableList.builder() ### Description Returns a new builder. ### Method `static ImmutableList.Builder builder()` ## ImmutableList.builderWithExpectedSize(int expectedSize) ### Description Returns a new builder, expecting the specified number of elements to be added. ### Method `static ImmutableList.Builder builderWithExpectedSize(int expectedSize)` ``` -------------------------------- ### ImmutableList.builderWithExpectedSize(int expectedSize) Source: https://guava.dev/ImmutableList Creates a new builder with a specified expected size for potential performance optimization. ```APIDOC ## ImmutableList.builderWithExpectedSize(int expectedSize) ### Description Returns a new builder, expecting the specified number of elements to be added. If `expectedSize` is exactly the number of elements added to the builder before `ImmutableList.Builder.build()` is called, the builder is likely to perform better than an unsized `builder()` would have. It is not specified if any performance benefits apply if `expectedSize` is close to, but not exactly, the number of elements added to the builder. ### Method `public static ImmutableList.Builder builderWithExpectedSize(int expectedSize)` ### Since 23.1 ``` -------------------------------- ### of() - Multiple Overloads Source: https://guava.dev/ImmutableList Factory methods to create ImmutableLists with zero to twelve elements, or with a varargs array for more. ```APIDOC ## of() ### Description Returns the empty immutable list. This list behaves and performs comparably to `Collections.emptyList()`, and is preferable mainly for consistency and maintainability of your code. **Performance note:** the instance returned is a singleton. ### Method Signature `public static ImmutableList of()` ## of(E e1) ### Description Returns an immutable list containing a single element. This list behaves and performs comparably to `Collections.singletonList(T)`, but will not accept a null element. It is preferable mainly for consistency and maintainability of your code. ### Method Signature `public static ImmutableList of(E e1)` ### Throws `NullPointerException` - if the element is null ## of(E e1, E e2) ### Description Returns an immutable list containing the given elements, in order. ### Method Signature `public static ImmutableList of(E e1, E e2)` ### Throws `NullPointerException` - if any element is null ## of(E e1, E e2, E e3) ### Description Returns an immutable list containing the given elements, in order. ### Method Signature `public static ImmutableList of(E e1, E e2, E e3)` ### Throws `NullPointerException` - if any element is null ## of(E e1, E e2, E e3, E e4) ### Description Returns an immutable list containing the given elements, in order. ### Method Signature `public static ImmutableList of(E e1, E e2, E e3, E e4)` ### Throws `NullPointerException` - if any element is null ## of(E e1, E e2, E e3, E e4, E e5) ### Description Returns an immutable list containing the given elements, in order. ### Method Signature `public static ImmutableList of(E e1, E e2, E e3, E e4, E e5)` ### Throws `NullPointerException` - if any element is null ## of(E e1, E e2, E e3, E e4, E e5, E e6) ### Description Returns an immutable list containing the given elements, in order. ### Method Signature `public static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6)` ### Throws `NullPointerException` - if any element is null ## of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) ### Description Returns an immutable list containing the given elements, in order. ### Method Signature `public static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7)` ### Throws `NullPointerException` - if any element is null ## of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) ### Description Returns an immutable list containing the given elements, in order. ### Method Signature `public static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8)` ### Throws `NullPointerException` - if any element is null ## of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) ### Description Returns an immutable list containing the given elements, in order. ### Method Signature `public static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9)` ### Throws `NullPointerException` - if any element is null ## of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) ### Description Returns an immutable list containing the given elements, in order. ### Method Signature `public static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10)` ### Throws `NullPointerException` - if any element is null ## of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11) ### Description Returns an immutable list containing the given elements, in order. ### Method Signature `public static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11)` ### Throws `NullPointerException` - if any element is null ## of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... others) ### Description Returns an immutable list containing the given elements, in order. The array `others` must not be longer than `Integer.MAX_VALUE - 12`. ### Method Signature `@SafeVarargs public static ImmutableList of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... others)` ### Throws `NullPointerException` - if any element is null ### Since 3.0 (source-compatible since 2.0) ``` -------------------------------- ### ImmutableList CopyOf Methods Source: https://guava.dev/ImmutableList Static methods to create immutable list instances by copying elements from various sources. ```APIDOC ## ImmutableList.copyOf(E[] elements) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList copyOf(E[] elements)` ## ImmutableList.copyOf(Iterable elements) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList copyOf(Iterable elements)` ## ImmutableList.copyOf(Collection elements) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList copyOf(Collection elements)` ## ImmutableList.copyOf(Iterator elements) ### Description Returns an immutable list containing the given elements, in order. ### Method `static ImmutableList copyOf(Iterator elements)` ``` -------------------------------- ### Add Guava Dependency (Gradle) Source: https://guava.dev/ Configure your Gradle build to include Guava. Choose between 'implementation' and 'api' configurations, and select the JRE or Android flavor. ```gradle dependencies { // Pick one: // 1. Use Guava in your implementation only: implementation("com.google.guava:guava:33.6.0-jre") // 2. Use Guava types in your public API: api("com.google.guava:guava:33.6.0-jre") // 3. Android - Use Guava in your implementation only: implementation("com.google.guava:guava:33.6.0-android") // 4. Android - Use Guava types in your public API: api("com.google.guava:guava:33.6.0-android") } ``` -------------------------------- ### ImmutableList.builder() Source: https://guava.dev/ImmutableList Creates a new builder for constructing immutable lists. ```APIDOC ## ImmutableList.builder() ### Description Returns a new builder. The generated builder is equivalent to the builder created by the `ImmutableList.Builder` constructor. ### Method `public static ImmutableList.Builder builder()` ``` -------------------------------- ### ImmutableList.asList() Source: https://guava.dev/ImmutableList Returns the list instance itself. This method is deprecated as there is no reason to use it. ```APIDOC ## ImmutableList.asList() ### Description Deprecated. There is no reason to use this; it always returns `this`. Returns this list instance. ### Method `@Deprecated public final ImmutableList asList()` ### Overrides `asList` in class `ImmutableCollection` ### Since 2.0 ``` -------------------------------- ### toImmutableList Source: https://guava.dev/ImmutableList Returns a Collector that accumulates input elements into a new ImmutableList in encounter order. ```APIDOC ## toImmutableList ### Description Returns a `Collector` that accumulates the input elements into a new `ImmutableList`, in encounter order. ### Method Signature `public static Collector> toImmutableList()` ### Since 21.0 ``` -------------------------------- ### AbstractCollection Methods Source: https://guava.dev/ImmutableList Methods inherited from the AbstractCollection class, providing basic collection functionalities. ```APIDOC ## containsAll(Collection c) ### Description Returns true if this collection contains all of the elements in the specified collection. ### Method boolean ## isEmpty() ### Description Returns true if this collection contains no elements. ### Method boolean ## size() ### Description Returns the number of elements in this collection. ### Method int ## toString() ### Description Returns a string representation of the object. In general, the toString method is implemented so that the string representation "conveniently and precisely" represents a value so that it is a useful string representation of an object for display purposes. ### Method String ``` -------------------------------- ### ImmutableList Deprecated Methods Source: https://guava.dev/ImmutableList Deprecated methods that should not be used. ```APIDOC ## ImmutableList.add(int index, E element) ### Description Unsupported operation. ### Method `final void add(int index, E element)` ## ImmutableList.addAll(int index, Collection newElements) ### Description Unsupported operation. ### Method `final boolean addAll(int index, Collection newElements)` ## ImmutableList.remove(int index) ### Description Unsupported operation. ### Method `final E remove(int index)` ## ImmutableList.replaceAll(UnaryOperator operator) ### Description Unsupported operation. ### Method `final void replaceAll(UnaryOperator operator)` ## ImmutableList.set(int index, E element) ### Description Unsupported operation. ### Method `final E set(int index, E element)` ## ImmutableList.sort(Comparator c) ### Description Unsupported operation. ### Method `final void sort(Comparator c)` ``` -------------------------------- ### toImmutableList Source: https://guava.dev/ImmutableList Provides a Collector to accumulate elements into an ImmutableList. ```APIDOC ## toImmutableList ### Description Returns a `Collector` that accumulates the input elements into a new `ImmutableList`, in encounter order. ### Method Signature `static Collector> toImmutableList()` ``` -------------------------------- ### Collection Interface Methods Source: https://guava.dev/ImmutableList Methods inherited from the Collection interface, including stream-related operations. ```APIDOC ## parallelStream() ### Description Returns an instance of a parallel stream that operates on this collection. ### Method Stream ## stream() ### Description Returns an instance of a sequential stream that operates on this collection. ### Method Stream ## toArray() ### Description Returns an array containing all of the elements in this collection. ### Method Object[] ``` -------------------------------- ### sortedCopyOf Source: https://guava.dev/ImmutableList Creates an immutable list containing the given elements, sorted according to their natural order or a specified comparator. ```APIDOC ## sortedCopyOf ### Description Returns an immutable list containing the given elements, sorted according to their natural order. ### Method Signature `static ImmutableList sortedCopyOf(Iterable elements)` ### Description Returns an immutable list containing the given elements, in sorted order relative to the specified comparator. ### Method Signature `static ImmutableList sortedCopyOf(Comparator comparator, Iterable elements)` ``` -------------------------------- ### ImmutableList.reverse() Source: https://guava.dev/ImmutableList Returns a view of the immutable list in reverse order. This operation does not modify the original list. ```APIDOC ## ImmutableList.reverse() ### Description Returns a view of this immutable list in reverse order. For example, `ImmutableList.of(1, 2, 3).reverse()` is equivalent to `ImmutableList.of(3, 2, 1)`. ### Method `public ImmutableList reverse()` ### Returns a view of this immutable list in reverse order ### Since 7.0 ``` -------------------------------- ### subList Source: https://guava.dev/ImmutableList Returns an immutable sublist of the elements within a specified range. ```APIDOC ## subList ### Description Returns an immutable list of the elements between the specified `fromIndex`, inclusive, and `toIndex`, exclusive. ### Method Signature `ImmutableList subList(int fromIndex, int toIndex)` ``` -------------------------------- ### Add Guava Dependency (Maven) Source: https://guava.dev/ Use this Maven dependency to include Guava in your project. Specify either the JRE or Android flavor in the version field. ```xml com.google.guava guava 33.6.0-jre 33.6.0-android ``` -------------------------------- ### copyOf() - Overloads Source: https://guava.dev/ImmutableList Factory methods to create ImmutableLists from Iterables or Collections. ```APIDOC ## copyOf(Iterable elements) ### Description Returns an immutable list containing the given elements, in order. If `elements` is a `Collection`, this method behaves exactly as `copyOf(Collection)`; otherwise, it behaves exactly as `copyOf(elements.iterator()`. ### Method Signature `public static ImmutableList copyOf(Iterable elements)` ### Throws `NullPointerException` - if `elements` contains a null element ## copyOf(Collection elements) ### Description Returns an immutable list containing the given elements, in order. Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change. Note that if `list` is a `List`, then `ImmutableList.copyOf(list)` returns an `ImmutableList` containing each of the strings in `list`, while `ImmutableList.of(list)` returns an `ImmutableList>` containing one element (the given list itself). This method is safe to use even when `elements` is a synchronized or concurrent collection that is currently being modified by another thread. ### Method Signature `public static ImmutableList copyOf(Collection elements)` ### Throws `NullPointerException` - if `elements` contains a null element ``` -------------------------------- ### ImmutableCollection Methods Source: https://guava.dev/ImmutableList These methods are inherited from ImmutableCollection. Many are deprecated and unsupported, indicating that direct modification of an ImmutableList is not intended. ```APIDOC ## add(E e) ### Description Deprecated. Unsupported operation. ### Method final boolean ## addAll(Collection newElements) ### Description Deprecated. Unsupported operation. ### Method final boolean ## clear() ### Description Deprecated. Unsupported operation. ### Method final void ## remove(@Nullable Object object) ### Description Deprecated. Unsupported operation. ### Method final boolean ## removeAll(Collection oldElements) ### Description Deprecated. Unsupported operation. ### Method final boolean ## removeIf(Predicate filter) ### Description Deprecated. Unsupported operation. ### Method final boolean ## retainAll(Collection elementsToKeep) ### Description Deprecated. Unsupported operation. ### Method final boolean ## toArray() ### Description Returns an array containing all of the elements in this collection. ### Method final Object[] ## toArray(T[] other) ### Description Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array. ### Method final T[] ``` -------------------------------- ### copyOf(E[]) Source: https://guava.dev/ImmutableList Creates an immutable list containing the elements from the given array, in order. ```APIDOC ## copyOf ### Description Returns an immutable list containing the given elements, in order. ### Method `public static ImmutableList copyOf(E[] elements)` ### Throws `NullPointerException` - if `elements` contains a null element ### Since 3.0 ``` -------------------------------- ### sortedCopyOf(Iterable) Source: https://guava.dev/ImmutableList Returns an immutable list containing the given elements, sorted according to their natural order. ```APIDOC ## sortedCopyOf ### Description Returns an immutable list containing the given elements, sorted according to their natural order. The sorting algorithm used is stable, so elements that compare as equal will stay in the order in which they appear in the input. ### Method `public static > ImmutableList sortedCopyOf(Iterable elements)` ### Throws `NullPointerException` - if any element in the input is null ### Since 21.0 ``` -------------------------------- ### sortedCopyOf(Comparator, Iterable) Source: https://guava.dev/ImmutableList Returns an immutable list containing the given elements, in sorted order relative to the specified comparator. ```APIDOC ## sortedCopyOf ### Description Returns an immutable list containing the given elements, in sorted order relative to the specified comparator. The sorting algorithm used is stable, so elements that compare as equal will stay in the order in which they appear in the input. ### Method `public static ImmutableList sortedCopyOf(Comparator comparator, Iterable elements)` ### Throws `NullPointerException` - if any element in the input is null ### Since 21.0 ``` -------------------------------- ### copyOf(Iterator) Source: https://guava.dev/ImmutableList Creates an immutable list containing the elements from the given iterator, in order. ```APIDOC ## copyOf ### Description Returns an immutable list containing the given elements, in order. ### Method `public static ImmutableList copyOf(Iterator elements)` ### Throws `NullPointerException` - if `elements` contains a null element ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.