October 2015
Beginner to intermediate
296 pages
5h 56m
English
Streams can be of fixed or infinite length. In the previous example, we used an array of integers to create a fixed length stream. However, if we want to process data arriving through a network connection, this stream of data may appear to be infinite. We can create both types of streams in Java 8.
We will use a Rectangle class to demonstrate the use of streams in several sections of this chapter. The class possesses position and dimension variables and three methods:
scale: This changes the size of a rectanglegetArea: This returns its areatoString: This displays its valuesThe class declaration follows:
public class Rectangle { private int x; private int y; private int height; private int width; public Rectangle(int x, int y, int ...Read now
Unlock full access