OnJava8-Examples/streams/Machine2.java

21 lines
411 B
Java
Raw Normal View History

// streams/Machine2.java
2015-11-14 16:18:05 -08:00
// <20>2016 MindView LLC: see Copyright.txt
import java.util.*;
public class Machine2 {
public static void main(String[] args) {
Arrays.stream(new Operation[] {
() -> Operation.show("Bing"),
() -> Operation.show("Crack"),
() -> Operation.show("Twist"),
() -> Operation.show("Pop")
}).forEach(Operation::execute);
}
}
/* Output:
Bing
Crack
Twist
Pop
*/