com.g2forge.alexandria.adt.collection.DStreamCollection Maven / Gradle / Ivy
package com.g2forge.alexandria.adt.collection;
import java.util.Collection;
import java.util.Iterator;
import java.util.stream.Collectors;
/**
* Sub-interface of {@link ICollection} which allows functional implementation of just the {@link ICollection#stream()} method.
*
* @param The type of the elements in this collection.
*/
@FunctionalInterface
public interface DStreamCollection extends ICollection {
public default Iterator iterator() {
return stream().iterator();
}
public default Collection toCollection() {
return stream().collect(Collectors.toList());
}
}