VCollections.src.org.violetlib.collections.impl.CompositeIterable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vcollections Show documentation
Show all versions of vcollections Show documentation
Java Immutable Collections
The newest version!
/*
* Copyright (c) 2023 Alan Snyder.
* All rights reserved.
*
* You may not use, copy or modify this file, except in compliance with the license agreement. For details see
* accompanying license terms.
*/
package org.violetlib.collections.impl;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.violetlib.collections.IIterable;
import org.violetlib.collections.IIterator;
import org.violetlib.collections.IList;
import org.violetlib.collections.ListBuilder;
import org.jetbrains.annotations.*;
/**
A source of iterators constructed from multiple sources. Sources are iterables or specific elements.
*/
public final class CompositeIterable
implements IIterable
{
public static @NotNull Builder builder()
{
return new MyBuilder();
}
public interface Builder
{
void addIterable(@NotNull Iterable iterable);
void addElement(@NotNull E element);
@NotNull IIterable value();
}
private static class MyBuilder
implements Builder
{
private ListBuilder