Code for the article "Java 8 Stream API Tutorial"

alextrentton@gmail.com

Signed-off-by: <alextrentton@gmail.com>
This commit is contained in:
alexVengrovsk
2016-06-09 23:31:30 +03:00
parent 7335ef2a65
commit 9835081ad3
2 changed files with 320 additions and 0 deletions
@@ -0,0 +1,51 @@
package com.baeldung.streamApi;
import java.util.List;
import java.util.Optional;
import java.util.stream.IntStream;
import java.util.stream.Stream;
/**
* Created by Alex Vengr
*/
public class Product {
private int price;
private String name;
private boolean utilize;
public Product(int price, String name) {
this(price);
this.name = name;
}
public Product(int price) {
this.price = price;
}
public Product() {
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static Stream<String> streamOf(List<String> list) {
return (list == null || list.isEmpty()) ? Stream.empty() : list.stream();
}
}