Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.function.Consumer;
- public class Main {
- public static class HeavyBox {
- public int weight;
- public HeavyBox(int weight) {
- this.weight = weight;
- }
- }
- public static void main(String[] args) {
- HeavyBox Box1 = new HeavyBox(237);
- Consumer<HeavyBox> Ref = (HeavyBox Box) -> {
- System.out.println("Отгрузили ящик весом " +Box.weight);
- };
- Consumer<HeavyBox> Ref2 = (HeavyBox Box) -> {
- System.out.println("Отправляем ящик весом " +Box.weight);
- };
- Ref.andThen(Ref2).accept(Box1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement