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>

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 Summary

    Constructors
    Constructor
    Description
    Constructor
    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 Summary

    Modifier and Type
    Method
    Description
    protected List<E>
     
    final FluentList<E>
    with(E... elements)
     
    final FluentList<E>
    with(List<E> elements)
     

    Methods inherited from class com.google.common.collect.ForwardingList

    add, addAll, equals, get, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, set, standardAdd, standardAddAll, standardEquals, standardHashCode, standardIndexOf, standardIterator, standardLastIndexOf, standardListIterator, standardListIterator, standardSubList, subList

    Methods inherited from class com.google.common.collect.ForwardingCollection

    add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRemoveAll, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArray

    Methods inherited from class com.google.common.collect.ForwardingObject

    toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    parallelStream, removeIf, stream, toArray

    Methods inherited from interface java.lang.Iterable

    forEach
  • 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>