JavaDoc: Factory classes description confusing about of() and with()
Chealer opened this issue · comments
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).
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"); *
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");
*
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