code: public static <T, W extends Collection<?>> Iterator<W> trails(int trailSize, Iterable<T> iterable, Function<Queue<Optional<T>>, W> copy) {
          dbc.precondition(iterable != null, "cannot create a trails iterator from a null iterable");
          return new TrailsIterator<>(iterable.iterator(), trailSize, copy);
      }
docs: Adapts an iterator to an iterator showing predecessors of the contained
  elements. Copy semantics of the internal queue yielded is controlled by
  the copy function. e.g:
  <code>
  iterable: [1,2,3,4], trailSize: 3 ->
  [[Nothing, Nothing, Just 1],[Nothing Just 1, Just 2], [Just 1, Just 2, Just 3], [Just 2, Just 3, Just 4]]
  </code>
  
  @param <T> the adapted iterator element type
  @param <W> the window type
  @param trailSize the trail size
  @param iterable the iterable to be adapted
  @param copy copy semantics for the internal queue
  @return the adapted iterator