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

net.sf.staccatocommons.collections.stream.Branchable 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.defs.Applicable;
import net.sf.staccatocommons.defs.tuple.Tuple2;

/**
 * @author flbulgarelli
 * @since 1.2
 */
public interface Branchable {

  @Projection
   Stream> clone(Applicable function);

  /**
   * Answers a Stream of pairs, where each one contains both results of applying
   * the given functions. Equivalent to
   * this.map(Tuples.branch(function0, function1))
   * 
   * @param 
   * @param 
   * @param function0
   * @param function1
   * @return a new {@link Stream}
   * @since 1.2
   */
  @Projection
   Stream> branch(Applicable function0,
    Applicable function1);

}