import java.util.stream.*;
public class StreamTest {
	public static void main(String[] args) {
		// a-Streaming z
		Stream<String> stream = Stream.iterate('a', c -> ++c).map(Object::toString).limit('z' - 'a' + 1);
		//first use of stream
		try {
			String collect_01 = stream.filter(str -> {
				byte[] b = str.getBytes();
				return (b[0] % 2 == 0);
			}).collect(Collectors.joining(";"));
			System.out.println(collect_01);
		} catch (Exception e) {
			System.err.println(e.getMessage());
		}
		//stream reuse--Fail
		try {
			String collect_02 = stream.map(str -> "[" + str + "]").collect(Collectors.joining(";"));
			System.out.println(collect_02);
		} catch (Exception e) {
			System.err.println(e.getMessage());
		}
	}
}
--I got the error [stream has already been operated upon or closed].
b;d;f;h;j;l;n;p;r;t;v;x;z
stream has already been operated upon or closed
――In order to process, count, and so on, shouldn't everything be stream?
Recommended Posts