Follow these steps to learn how to use lambda expressions:
- Let's start building an API. We will call it Traffic. Without using functional interfaces, it might look like this:
public interface Traffic { void speedAfterStart(double timeSec, int trafficUnitsNumber);}
Its implementation may be as follows:
public class TrafficImpl implements Traffic { private int hour; private Month month; private DayOfWeek dayOfWeek; private String country, city, trafficLight; public TrafficImpl(Month month, DayOfWeek dayOfWeek, int hour, String country, String city, String trafficLight){ this.hour = hour; this.city = city; this.month = month; this.country = country; this.dayOfWeek = dayOfWeek; this.trafficLight = trafficLight; } public void ...