refactor Stream.java