Skip to content

Commit

Permalink
. d updated markdown snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 28, 2024
1 parent 402c45d commit 53f776c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions approvaltests-util/docs/how_to/ExtendQueryable.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static Queryable<String> findFirstWordsOnly(List<String> words)
});
}
```
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L34-L49' title='Snippet source file'>snippet source</a> | <a href='#snippet-custom-query' title='Start of snippet'>anchor</a></sup>
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L35-L50' title='Snippet source file'>snippet source</a> | <a href='#snippet-custom-query' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
You can add this to Queryable by implementing the `com.lambda.utils.Extendable` interface.
<!-- snippet: implementing-extendable -->
Expand All @@ -35,7 +35,7 @@ public static class CustomQuery implements Extendable<List<String>>
this.caller = caller;
}
```
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L18-L27' title='Snippet source file'>snippet source</a> | <a href='#snippet-implementing-extendable' title='Start of snippet'>anchor</a></sup>
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L19-L28' title='Snippet source file'>snippet source</a> | <a href='#snippet-implementing-extendable' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
Now you can add extension methods that are **not static**
<!-- snippet: extendable-query -->
Expand All @@ -46,7 +46,7 @@ public Queryable<String> findFirstWordsOnly()
return findFirstWordsOnly(caller);
}
```
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L28-L33' title='Snippet source file'>snippet source</a> | <a href='#snippet-extendable-query' title='Start of snippet'>anchor</a></sup>
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L29-L34' title='Snippet source file'>snippet source</a> | <a href='#snippet-extendable-query' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
and now you can call it as such
<!-- snippet: custom-query-example -->
Expand All @@ -56,7 +56,7 @@ Queryable<String> list = Queryable.as("One fish", "two fish", "red fish", "blue
Queryable<String> firstWordsOnlyWithExtension = list.select(String::toUpperCase).use(CustomQuery.class)
.findFirstWordsOnly();
```
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L54-L58' title='Snippet source file'>snippet source</a> | <a href='#snippet-custom-query-example' title='Start of snippet'>anchor</a></sup>
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L55-L59' title='Snippet source file'>snippet source</a> | <a href='#snippet-custom-query-example' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
whereas previously you had to use
<!-- snippet: custom-query-example-static -->
Expand All @@ -65,7 +65,7 @@ whereas previously you had to use
Queryable<String> firstWordsOnlyStatic = CustomQuery
.findFirstWordsOnly(Query.select(list, String::toUpperCase));
```
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L59-L62' title='Snippet source file'>snippet source</a> | <a href='#snippet-custom-query-example-static' title='Start of snippet'>anchor</a></sup>
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L60-L63' title='Snippet source file'>snippet source</a> | <a href='#snippet-custom-query-example-static' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

## See also
Expand Down
6 changes: 3 additions & 3 deletions approvaltests-util/docs/reference/Query.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Queryable<String> names = Queryable.as("Now is the time", "Fourscore and seven y
"When in the course of human events");
Queryable<String> allNames = names.selectMany(n -> Arrays.asList(n.split(" "))).orderBy(n -> n);
```
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L141-L145' title='Snippet source file'>snippet source</a> | <a href='#snippet-queryable_select_many' title='Start of snippet'>anchor</a></sup>
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L142-L146' title='Snippet source file'>snippet source</a> | <a href='#snippet-queryable_select_many' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

resulting in
Expand Down Expand Up @@ -157,7 +157,7 @@ Here is a simple example of grouping words by their first letter.
Queryable<String> words = Queryable.as("Jack", "and", "Jill", "jumped", "up", "the", "hill");
Queryable<Entry<Character, Queryable<String>>> result = words.groupBy(w -> w.toLowerCase().charAt(0));
```
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L151-L154' title='Snippet source file'>snippet source</a> | <a href='#snippet-group_by_key' title='Start of snippet'>anchor</a></sup>
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L152-L155' title='Snippet source file'>snippet source</a> | <a href='#snippet-group_by_key' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
producing:
<!-- snippet: QueryableTest.testGroupBy.approved.txt -->
Expand Down Expand Up @@ -185,7 +185,7 @@ Queryable<String> words = Queryable.as("One Fish Two Fish Red Fish Blue Fish".sp
Queryable<Entry<Object, Object>> result = words.groupBy(w -> w.length(), w -> w.toLowerCase(),
r -> r.join("_"));
```
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L174-L178' title='Snippet source file'>snippet source</a> | <a href='#snippet-group_by_full' title='Start of snippet'>anchor</a></sup>
<sup><a href='/approvaltests-util-tests/src/test/java/org/lambda/query/QueryableTest.java#L175-L179' title='Snippet source file'>snippet source</a> | <a href='#snippet-group_by_full' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
resulting in
<!-- snippet: QueryableTest.testGroupByCombineWordsOfSimilarLengths.approved.txt -->
Expand Down

0 comments on commit 53f776c

Please sign in to comment.