Skip to content

Commit

Permalink
#98: doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jun 9, 2017
1 parent a6bf96e commit c3fecb2
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,49 @@ int total = new LengthOfIterable(
).asValue();
```

## Funcs and Procs

This is a traditional `foreach` loop:

```java
for (String name : names) {
System.out.printf("Hello, %s!\n", name);
}
```

This is its object-oriented alternative (no streams!):

```java
new IterableAsBoolean<>(
names,
new ProcAsFunc<>(
n -> {
System.out.printf("Hello, %s!\n", n);
}
)
).asValue();
```

This is an endless `while/do` loop:

```java
while (!ready) {
System.out.prinln("Still waiting...");
}
```

Here is its object-oriented alternative:

```java
new IterableAsBoolean<>(
new EndlessIterable<>(ready),
r -> {
System.out.prinln("Still waiting...");
return !ready;
}
).asValue();
```

## How to contribute?

Just fork the repo and send us a pull request.
Expand Down

0 comments on commit c3fecb2

Please sign in to comment.