Class ElementsSatisfyingConsumer<E>

  • Type Parameters:
    E - element type

    class ElementsSatisfyingConsumer<E>
    extends Object
    Wrapper for the list of elements that satisfy certain requirements (expressed as a Consumer).
    Author:
    Michael Grafl
    • Field Detail

      • elements

        private final List<E> elements
    • Constructor Detail

      • ElementsSatisfyingConsumer

        ElementsSatisfyingConsumer​(Iterable<? extends E> actual,
                                   Consumer<? super E> assertions)
      • ElementsSatisfyingConsumer

        private ElementsSatisfyingConsumer​(List<E> elements)
    • Method Detail

      • getElements

        List<E> getElements()
      • withoutElement

        ElementsSatisfyingConsumer<E> withoutElement​(E element)
        New ElementsSatisfyingConsumer containing all elements except the (first occurrence of the) given element.

        This instance is not modified.

        Parameters:
        element - the element to remove from the result
        Returns:
        all except the given element
      • filterByPassingAssertions

        private static <E> List<E> filterByPassingAssertions​(Iterable<? extends E> actual,
                                                             Consumer<? super E> assertions)