import java.util.*;
import java.util.stream.Collectors;

public class StreamTest {
    public static void main(String[] args) {
        List<Product> list = new ArrayList<>();
        list.add(new Product(1, "NoteBook", 100));
        list.add(new Product(2, "TV", 320));
        list.add(new Product(3, "Washing Machine", 250));
        list.add(new Product(4, "Air Conditioner", 500));

        List<String> result = list.stream()
            .filter(p -> p.price > 300)
            .map(p -> p.name)
            .collect(Collectors.toList());

        System.out.println(result);
    }
}
