public class Test {
public static void main(String[] args) {
MyClass myClass = new MyClass();
Stream.generate(ToProcess::new).limit(10).map(myClass::process);
}
}
class MyClass{
ToProcess process(ToProcess obj){
// processing
return obj;
}
}
class ToProcess {
}