November 2017
Intermediate to advanced
398 pages
10h 14m
English
The first and the most straightforward way to do filtering is using the filter() operation. To demonstrate all the following capabilities, we will use the Senator class:
public class Senator { private int[] voteYes, voteNo; private String name, party; public Senator(String name, String party, int[] voteYes, int[] voteNo) { this.voteYes = voteYes; this.voteNo = voteNo; this.name = name; this.party = party; } public int[] getVoteYes() { return voteYes; } public int[] getVoteNo() { return voteNo; } public String getName() { return name; } public String getParty() { return party; } public String toString() { return getName() + ", P" + getParty().substring(getParty().length() - 1); }}
As you can see, this class captures a senator's ...
Read now
Unlock full access