Skip to content
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

Merged
merged 3 commits into from
Dec 3, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,33 @@ int total = new LengthOf(
).intValue();
```

To get a set of unique elements by providing varargs:
Copy link
Contributor

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 with To create a set?

Copy link
Contributor Author

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 with To create a set?

@iakunin Agree, will fix.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fanifieiev a phrase set of unique elements could be a little bit excessive one, because the definition of Set already implies that:

set is an abstract data type that can store unique values

@fanifieiev what do you think?

Copy link
Contributor Author

@fanifieiev fanifieiev Nov 28, 2019

Choose a reason for hiding this comment

The 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:
Copy link
Contributor

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 with To create a set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iakunin Agree, will fix.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fanifieiev a phrase set of unique elements could be a little bit excessive one, because the definition of Set already implies that:

set is an abstract data type that can store unique values

@fanifieiev what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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:
Copy link
Contributor

Choose a reason for hiding this comment

The 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 To create sorted iterable

```java
final Iterable<String> sorted = new Sorted<>(
new SetOf<>(
new IterableOf<>("abc", "bcd", "abc", "ccc")
)
);
```

## Funcs and Procs

This is a traditional `foreach` loop:
Expand Down