Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package org.coffeedriven;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class StreamExample2 {
public static void main(String[] args) {
List<Item> items = new ArrayList<Item>();
items.add(new Item("itemA", 1, new BigDecimal("1.0")));
items.add(new Item("itemB", 2, new BigDecimal("2.0")));
items.add(new Item("itemC", 3, new BigDecimal("3.0")));
List<String> names =
.map(item -> item.getName())
.filter(name -> name.endsWith("C"))
System.out.println("Names with C : " + names);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment