Class CommonsCopyOnWriteArrayList<ELEMENTTYPE>

    • Constructor Detail

      • CommonsCopyOnWriteArrayList

        public CommonsCopyOnWriteArrayList()
        Create a new empty array list.
      • CommonsCopyOnWriteArrayList

        public CommonsCopyOnWriteArrayList​(@Nullable
                                           Iterable<? extends SRCTYPE> aValues,
                                           @Nonnull
                                           Function<? super SRCTYPE,​? extends ELEMENTTYPE> aMapper)
        Create a new array list with all mapped items of the provided iterable.
        Type Parameters:
        SRCTYPE - source data type
        Parameters:
        aValues - The iterable from which the elements are copied from. May be null.
        aMapper - The mapping function to be executed for all provided elements. May not be null.
        See Also:
        ICommonsCollection.addAllMapped(Iterable, Function)
      • CommonsCopyOnWriteArrayList

        public CommonsCopyOnWriteArrayList​(@Nullable
                                           ELEMENTTYPE aValue)
        Create a new array list with an initial capacity of 1 and exactly the provided value, even if it is null.
        Parameters:
        aValue - The value to be added. May be null.
      • CommonsCopyOnWriteArrayList

        public CommonsCopyOnWriteArrayList​(@Nullable
                                           SRCTYPE[] aValues,
                                           @Nonnull
                                           Function<? super SRCTYPE,​? extends ELEMENTTYPE> aMapper)
        Create a new array list that contains mapped elements of the provided array.
        Type Parameters:
        SRCTYPE - source data type
        Parameters:
        aValues - The array to copy the elements from. May be null.
        aMapper - The mapping function to be executed for all provided elements. May not be null.
        See Also:
        ICommonsCollection.addAllMapped(Object[], Function)
    • Method Detail

      • createFiltered

        @Nonnull
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> CommonsCopyOnWriteArrayList<ELEMENTTYPE> createFiltered​(@Nullable
                                                                                            Iterable<? extends ELEMENTTYPE> aValues,
                                                                                            @Nullable
                                                                                            Predicate<? super ELEMENTTYPE> aFilter)
        Create a new array list that contains a subset of the provided iterable.
        Note: this method is a static factory method because the compiler sometimes cannot deduce between Predicate and Function and the mapping case occurs more often.
        Type Parameters:
        ELEMENTTYPE - data type of the list
        Parameters:
        aValues - The iterable from which the elements are copied from. May be null.
        aFilter - The filter to be applied to check if the element should be added or not.
        Returns:
        The created array list. Never null.
        Since:
        9.1.3
        See Also:
        ICommonsCollection.addAll(Iterable, Predicate)
      • createFiltered

        @Nonnull
        @ReturnsMutableCopy
        public static <SRCTYPE,​ELEMENTTYPE> CommonsCopyOnWriteArrayList<ELEMENTTYPE> createFiltered​(@Nullable
                                                                                                          Iterable<? extends SRCTYPE> aValues,
                                                                                                          @Nullable
                                                                                                          Predicate<? super SRCTYPE> aFilter,
                                                                                                          @Nonnull
                                                                                                          Function<? super SRCTYPE,​? extends ELEMENTTYPE> aMapper)
        Create a new array list that contains a subset of the provided iterable. This method filters the elements before they are mapped.
        Note: this method is a static factory method because the compiler sometimes cannot deduce between Predicate and Function and the mapping case occurs more often.
        Type Parameters:
        SRCTYPE - source data type
        ELEMENTTYPE - final data type of the list
        Parameters:
        aValues - The iterable from which the elements are copied from. May be null.
        aFilter - The filter to be applied to check if the element should be added or not.
        aMapper - The mapping function to be executed for all provided elements. May not be null.
        Returns:
        The created array list. Never null.
        Since:
        9.1.3
        See Also:
        ICommonsCollection.addAllMapped(Iterable, Predicate, Function)
      • createFiltered

        @Nonnull
        @ReturnsMutableCopy
        public static <SRCTYPE,​ELEMENTTYPE> CommonsCopyOnWriteArrayList<ELEMENTTYPE> createFiltered​(@Nullable
                                                                                                          Iterable<? extends SRCTYPE> aValues,
                                                                                                          @Nonnull
                                                                                                          Function<? super SRCTYPE,​? extends ELEMENTTYPE> aMapper,
                                                                                                          @Nullable
                                                                                                          Predicate<? super ELEMENTTYPE> aFilter)
        Create a new array list that contains a subset of the provided iterable. This method maps the elements before they are filtered.
        Note: this method is a static factory method because the compiler sometimes cannot deduce between Predicate and Function and the mapping case occurs more often.
        Type Parameters:
        SRCTYPE - source data type
        ELEMENTTYPE - final data type of the list
        Parameters:
        aValues - The iterable from which the elements are copied from. May be null.
        aMapper - The mapping function to be executed for all provided elements. May not be null.
        aFilter - The filter to be applied on the mapped element to check if the element should be added or not.
        Returns:
        The created array list. Never null.
        Since:
        9.1.3
        See Also:
        ICommonsCollection.addAllMapped(Iterable, Function, Predicate)
      • createFiltered

        @Nonnull
        @ReturnsMutableCopy
        public static <ELEMENTTYPE> CommonsCopyOnWriteArrayList<ELEMENTTYPE> createFiltered​(@Nullable
                                                                                            ELEMENTTYPE[] aValues,
                                                                                            @Nullable
                                                                                            Predicate<? super ELEMENTTYPE> aFilter)
        Create a new array list that contains a subset of the provided array.
        Note: this method is a static factory method because the compiler sometimes cannot deduce between Predicate and Function and the mapping case occurs more often.
        Type Parameters:
        ELEMENTTYPE - data type of the list
        Parameters:
        aValues - The array from which the elements are copied from. May be null.
        aFilter - The filter to be applied to check if the element should be added or not.
        Returns:
        The created array list. Never null.
        Since:
        9.1.3
        See Also:
        ICommonsCollection.addAll(Object[], Predicate)
      • createFiltered

        @Nonnull
        @ReturnsMutableCopy
        public static <SRCTYPE,​ELEMENTTYPE> CommonsCopyOnWriteArrayList<ELEMENTTYPE> createFiltered​(@Nullable
                                                                                                          SRCTYPE[] aValues,
                                                                                                          @Nullable
                                                                                                          Predicate<? super SRCTYPE> aFilter,
                                                                                                          @Nonnull
                                                                                                          Function<? super SRCTYPE,​? extends ELEMENTTYPE> aMapper)
        Create a new array list that contains a subset of the provided array. This method filters the elements before they are mapped.
        Note: this method is a static factory method because the compiler sometimes cannot deduce between Predicate and Function and the mapping case occurs more often.
        Type Parameters:
        SRCTYPE - source data type
        ELEMENTTYPE - final data type of the list
        Parameters:
        aValues - The array from which the elements are copied from. May be null.
        aFilter - The filter to be applied to check if the element should be added or not.
        aMapper - The mapping function to be executed for all provided elements. May not be null.
        Returns:
        The created array list. Never null.
        Since:
        9.1.3
        See Also:
        ICommonsCollection.addAllMapped(Object[], Predicate, Function)
      • createFiltered

        @Nonnull
        @ReturnsMutableCopy
        public static <SRCTYPE,​ELEMENTTYPE> CommonsCopyOnWriteArrayList<ELEMENTTYPE> createFiltered​(@Nullable
                                                                                                          SRCTYPE[] aValues,
                                                                                                          @Nonnull
                                                                                                          Function<? super SRCTYPE,​? extends ELEMENTTYPE> aMapper,
                                                                                                          @Nullable
                                                                                                          Predicate<? super ELEMENTTYPE> aFilter)
        Create a new array list that contains a subset of the provided array. This method maps the elements before they are filtered.
        Note: this method is a static factory method because the compiler sometimes cannot deduce between Predicate and Function and the mapping case occurs more often.
        Type Parameters:
        SRCTYPE - source data type
        ELEMENTTYPE - final data type of the list
        Parameters:
        aValues - The array from which the elements are copied from. May be null.
        aMapper - The mapping function to be executed for all provided elements. May not be null.
        aFilter - The filter to be applied on the mapped element to check if the element should be added or not.
        Returns:
        The created array list. Never null.
        Since:
        9.1.3
        See Also:
        ICommonsCollection.addAllMapped(Iterable, Function, Predicate)