Class FluentList<E>

java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingCollection<E>
com.google.common.collect.ForwardingList<E>
com.kingsrook.qqq.backend.core.utils.collections.FluentList<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, SequencedCollection<E>

public class FluentList<E> extends com.google.common.collect.ForwardingList<E>
Alternative list-builder pattern (vs. List.of() or ListBuilder.of()) for contexts where you want to make a list out of elements and lists of those elements. e.g., if you wanted to make a list that had value (1, 2, 3, 4), but were building it in such a way that you were getting the elements like this: List.of( 1, List.of(2, 3), 4) which might make more sense if you were calling methods that returned either those individual elements or lists... anyway, with this class, you could do that as: new FluentList() .with(1) .with(List.of(2, 3)) .with(4)
  • Constructor Details

    • FluentList

      public FluentList()
      Constructor
    • FluentList

      public FluentList(List<E> list)
      Constructor that lets you supply a source list (which will be wrapped by MutableList, just in case you pass in an immutable one)
  • Method Details

    • with

      @SafeVarargs public final FluentList<E> with(E... elements)
    • with

      public final FluentList<E> with(List<E> elements)
    • delegate

      protected List<E> delegate()
      Specified by:
      delegate in class com.google.common.collect.ForwardingList<E>