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

JavaDoc: Factory classes description confusing about of() and with() #1490

Open
Chealer opened this issue Aug 21, 2023 · 3 comments
Open

JavaDoc: Factory classes description confusing about of() and with() #1490

Chealer opened this issue Aug 21, 2023 · 3 comments

Comments

@Chealer
Copy link

Chealer commented Aug 21, 2023

The JavaDoc for factory classes contains examples. For example, the description of org.eclipse.collections.impl.factory.Sets contains:

Mutable Examples:

MutableSet<String> emptySet = Sets.mutable.empty();
MutableSet<String> setWith = Sets.mutable.with("a", "b", "c");
MutableSet<String> setOf = Sets.mutable.of("a", "b", "c");

A reader will wonder how the last 2 examples (setWith and setOf) differ (besides names). It turns out they don't; they are merely synonyms.

I recommend to stick with a single form, or to indicate that they are synonymous (or at least, to describe the effect of each).

@BrijeshPatra
Copy link

I am working on this issue and here what I came to conclusion that the updated doc should be after describing effect of each.

 * //Creates an empty mutable set
 * MutableSet<String> emptySet = Sets.mutable.empty();
 * // Creates a mutable set containing the specified elements "a", "b", and "c"
 * MutableSet<String> setWith = Sets.mutable.with("a", "b", "c");
 * // Creates a mutable set containing the specified elements "a", "b", and "c" (synonymous with setWith)
 * MutableSet<String> setOf = Sets.mutable.of("a", "b", "c");
 * 

@Chealer
Copy link
Author

Chealer commented Aug 22, 2023

Greetings @BrijeshPatra ,
Thanks, that's quite reasonable, but I would suggest:

 * // Creates an empty mutable set
 * MutableSet<String> emptySet = Sets.mutable.empty();
 *
 * // Equivalents which create a mutable set containing the specified elements ("a", "b" and "c"):
 * MutableSet<String> setWith = Sets.mutable.with("a", "b", "c");
 * MutableSet<String> setOf = Sets.mutable.of("a", "b", "c");
 * 

@BrijeshPatra
Copy link

Hello, @Chealer

Thank you for your prompt response and for addressing the documentation issue. I appreciate the changes made to improve the clarity of the documentation for Sets.mutable.

If you have any more questions or if there's anything else I can assist with, please feel free to let me know.

Best regards,
Brijesh Patra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants