Skip to content

Commit

Permalink
Merge pull request yegor256#273 from alex-semenyuk/master
Browse files Browse the repository at this point in the history
yegor256#272 Fix examples from README to make them workable.
  • Loading branch information
yegor256 authored Jul 2, 2017
2 parents e58e7e1 + 60de5f1 commit 22e8b4f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ new UpperText("Hello");
To filter a collection:

```java
Collection<String> filtered = new IterableAsCollection<>(
Collection<String> filtered = new IterableAsList<>(
new FilteredIterable<>(
new ArrayAsIterable<>("hello", "world", "dude"),
new Func<String, Boolean>() {
@Override
public boolean apply(String s) {
public Boolean apply(String s) {
return s.length() > 4;
}
}
Expand All @@ -134,7 +134,7 @@ Collection<String> filtered = new IterableAsCollection<>(
With Lambda:

```java
new IterableAsCollection<>(
new IterableAsList<>(
new FilteredIterable<>(
new ArrayAsIterable<>("hello", "world", "dude"),
s -> s.length() > 4
Expand All @@ -161,24 +161,25 @@ Or even more compact:

```java
new And(
input -> System.out.printf("Item: %s\n", input),
(String input) -> System.out.printf("Item: %s\n", input),
"how", "are", "you"
).value();
```

To sort a list of words in the file:

```java
List<String> sorted = new SortedList<>(
new IterableAsList<>(
List<String> sorted = new IterableAsList<>(
new SortedIterable<>(
new SplitText(
new BytesAsText(
new InputAsBytes(
new FileAsInput(
new File("/tmp/names.txt")
)
)
)
),
new StringAsText("\\s+")
)
)
);
Expand Down

0 comments on commit 22e8b4f

Please sign in to comment.