Class NamedArrayList<E>

    • Constructor Detail

      • NamedArrayList

        public NamedArrayList​(@NonNull
                              String name,
                              Collection<? extends E> c)
        Copy constructor.
        Parameters:
        name - the name.
        c - the collection whose elements are to be placed into this list
      • NamedArrayList

        public NamedArrayList​(@NonNull
                              String name,
                              E... elements)
        Copy constructor.
        Parameters:
        name - the name.
        elements - the initial elements.
    • Method Detail

      • getName

        @NonNull
        public final String getName()
        Gets the associate name.
        Returns:
        the associate name.
      • select

        public static <E> void select​(@NonNull
                                      List<? extends E> source,
                                      @NonNull
                                      String name,
                                      @CheckForNull
                                      NamedArrayList.Predicate<? super E> selector,
                                      boolean removeSelectedFromSource,
                                      @NonNull
                                      List<NamedArrayList<? extends E>> destination)
        Helper method that creates a new NamedArrayList by selecting matching elements from a source list and appends the new NamedArrayList to a list of NamedArrayList.
        Type Parameters:
        E - the type of element.
        Parameters:
        source - the list of candidate elements.
        name - the name.
        selector - the (optional) selection criteria (if null then all candidate elements will be added)
        removeSelectedFromSource - if true then the matching elements will be removed from the source.
        destination - the List of NamedArrayList to add to (empty selections will not be added)
      • select

        public static <E> void select​(@NonNull
                                      List<? extends E> source,
                                      @NonNull
                                      String name,
                                      @CheckForNull
                                      NamedArrayList.Predicate<? super E> selector,
                                      boolean removeSelectedFromSource,
                                      @NonNull
                                      List<NamedArrayList<? extends E>> destination,
                                      int index)
        Helper method that creates a new NamedArrayList by selecting matching elements from a source list and appends the new NamedArrayList to a list of NamedArrayList.
        Type Parameters:
        E - the type of element.
        Parameters:
        source - the list of candidate elements.
        name - the name.
        selector - the (optional) selection criteria (if null then all candidate elements will be added)
        removeSelectedFromSource - if true then the matching elements will be removed from the source.
        destination - the List of NamedArrayList to add to (empty selections will not be added)
        index - index at which the specified selection is to be inserted (will be coerced into the valid range to remove the risk of IndexOutOfBoundsException).
      • withAnnotation

        public static <A extends AnnotationNamedArrayList.Predicate<Object> withAnnotation​(Class<A> annotation)
        Returns a NamedArrayList.Predicate that checks if the object class has been annotated with the supplied annotation.
        Type Parameters:
        A - the type of annotation.
        Parameters:
        annotation - the annotation to check.
        Returns:
        the predicate.