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

VCollections.src.org.violetlib.collections.IIterable 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;

import org.violetlib.collections.impl.IterableWrapper;

import org.jetbrains.annotations.*;

/**
  A specialization of the Iterable interface to return iterators declared to return only non-null values.
*/

@FunctionalInterface
public interface IIterable
  extends Iterable
{
    /**
      Create an {@code IIterable} from an {@code Iterable}. The iterators produced by the returned {@code IIterable}
      will throw a runtime exception if an iterator produced by the {@code Iterable} returns a null value.
      @param it The source iterable.
    */

    static  @NotNull IIterable from(@NotNull Iterable it)
    {
        return IterableWrapper.create(it);
    }

    /**
      Returns an iterator over non-null elements of type {@code T}.

      @return an Iterator.
    */

    @Override
    @NotNull IIterator iterator();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy