package com.greenorange.promotion.list;

import java.util.ArrayList;
import java.util.List;

public class ListTest {
    public static void main(String[] args) {
        List<Node> list = new ArrayList<>();
        list.add(new Node(1));
        list.add(new Node(2));
        list.add(new Node(3));
        for (Node node : list) {
            System.out.println(node.val);
        }
        for (Node node : list) {
            node.setVal(1);
        }
        for (Node node : list) {
            System.out.println(node.val);
        }
    }
}

class Node {
    int val;
    public Node(int val) {
        this.val = val;
    }
    public void setVal(int val) {
        this.val = val;
    }
}