net.sf.staccatocommons.collections.stream.Appendable Maven / Gradle / Ivy
/**
* Copyright (c) 2011, The Staccato-Commons Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
package net.sf.staccatocommons.collections.stream;
import net.sf.staccatocommons.collections.restrictions.Projection;
import net.sf.staccatocommons.collections.restrictions.Repeatable;
import net.sf.staccatocommons.defs.Thunk;
import net.sf.staccatocommons.restrictions.check.NonNull;
/**
* @author flbulgarelli
*
*/
public interface Appendable {
/**
* Concatenates this with other
*
* It answers an {@link Stream} that retrieves elements from this Stream, and
* then, after its last element, from the given Stream.
*
* As a particular case, if this Stream is infinite, the resulting Stream will
* retrieve the same elements than this one.
*
* @param other
* @return a new {@link Stream}
*/
@Projection
Stream append(@NonNull Iterable other);
/**
* Concatenates this Stream with the undefined Stream. Equivalent to
* concat(Streams.undefined())
*
* @return a new {@link Stream}, {@link Repeatable} as long as {@code this} is
* repeatable
* @see Streams#undefined()
*/
@Projection
Stream appendUndefined();
/**
* Adds an element as the last one of the stream.
*
* @param element
* @return a new {@link Stream} that retrieves this {@link Stream} elements,
* and then, the given element
*/
@Projection
Stream append(A element);
/**
* Adds an element's thunk as the last one of the stream.
*
* @param thunk
* @return a new {@link Stream} that retrieves this {@link Stream} elements,
* and then, the value of the given thunk
*/
@Projection
Stream append(@NonNull Thunk thunk);
/**
* Adds an element as the first one of the stream.
*
* @param element
* @return a new {@link Stream} that retrieves the given element,
* and then, this {@link Stream} elements.
*/
@Projection
Stream prepend(A element);
/**
* Adds an element's thunk as the first one of the stream.
*
* @param thunk
* @return a new {@link Stream} that retrieves the value of the given
* thunk, and then, this {@link Stream} elements.
*/
@Projection
Stream prepend(@NonNull Thunk thunk);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy