Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // CHALLENGE (work in pairs):
- // Move from f(o) -> o.f() and sure that the code is CQS compliant.
- //
- // 1
- class CsvParser<T extends Lines> {
- Collection<T> parse(File location) {
- }
- }
- // 2
- interface Pinger {
- void sendPing();
- }
- // 3
- interface TcpSocket {
- Stream<Byte> startReading();
- }
- // 4
- // Iovation - a company that maintains a blacklist of email addresses and corresponding IPs
- interface IovationService {
- boolean shouldBlockWebsiteVisitor(IovationClientRequest request);
- }
- interface IovationClientRequest {
- String getEmail();
- String getIpAddress();
- }
- // 5
- interface AnonymousUserAuthenticator {
- Token authenticate(String username, String password) throws WrongAuthenticationCredentialsProvided;
- }
- // 6
- interface Test {
- interface TestResult {
- void print();
- }
- boolean over();
- Collection<TestResult> listTestResults();
- }
- if (test.over()) {
- for (TestResult tr : test.listTestResults()) {
- // pretty printing
- tr.print();
- }
- }
- // 7
- boolean destroyButtonAvailable =
- widgets
- .stream()
- .filter(Widget::isButton)
- .filter(button -> button.label().equals("Destroy The World"))
- .isPresent();
- // 8
- interface File {
- void openAndThrowIfNotFound();
- }
Add Comment
Please, Sign In to add comment