All Downloads are FREE. Search and download functionalities are using the official Maven repository.

VCollections.src.org.violetlib.collections.impl.ICollectionSequence Maven / Gradle / Ivy

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 org.violetlib.collections.ICollection;
import org.violetlib.collections.IIterable;
import org.violetlib.collections.IIterator;
import org.violetlib.collections.IList;

import org.jetbrains.annotations.*;

/**

*/

public final class ICollectionSequence
  implements ICollection
{
    public static  @NotNull ICollection create(@NotNull IList> sources)
    {
        return new ICollectionSequence<>(sources);
    }

    private final @NotNull IList> sources;

    private ICollectionSequence(@NotNull IList> sources)
    {
        this.sources = IList.cast(sources);
    }

    @Override
    public @NotNull IIterator iterator()
    {
        return SimpleCompositeIterator.create(sources.map(IIterable::iterator));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy