-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
README documentation for SetOf was added #1250
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,6 +208,33 @@ int total = new LengthOf( | |
).intValue(); | ||
``` | ||
|
||
To get a set of unique elements by providing varargs: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fanifieiev a phrase
@fanifieiev what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iakunin Agree. |
||
|
||
```java | ||
final Set<String> unique = new SetOf<String>( | ||
"one", | ||
"two", | ||
"one", | ||
"three" | ||
); | ||
``` | ||
|
||
To get a set of unique elements from existing iterable: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fanifieiev There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iakunin Agree, will fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fanifieiev a phrase
@fanifieiev what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iakunin Will fix that. |
||
```java | ||
final Set<String> words = new SetOf<>( | ||
new IterableOf<>("abc", "bcd", "abc", "ccc") | ||
); | ||
``` | ||
|
||
To get sorted iterable with unique elements from existing iterable: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fanifieiev just by analogy with the previous sentences we can start this one with |
||
```java | ||
final Iterable<String> sorted = new Sorted<>( | ||
new SetOf<>( | ||
new IterableOf<>("abc", "bcd", "abc", "ccc") | ||
) | ||
); | ||
``` | ||
|
||
## Funcs and Procs | ||
|
||
This is a traditional `foreach` loop: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fanifieiev
To get a set
sounds a little bit vague, in my opinion. Maybe it's better to start withTo create a set
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iakunin Agree, will fix.