Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Good point about having the method simply call the constructor of the public class. Since they would be effectively identical, I can expose both and make it very clear in the documentation that the method is simply a shortcut for the constructor. Also the linked article made a good point about having all composite objects inherit from the same subclass of LEDStrip. What I might do is in the base strip class, create two methods, one that accepts a Function<LedStrip, CompositeLedStrip> and one Function<List<LedStrip>, CompositeLedStrip> so users can pass in constructors in a functional style Commented Feb 10, 2017 at 14:05
  • if they wish to, or simply construct their class (or use a static factory) like normal. The second method would also accept a list to pass along to the constructor. The first method would simply use this as the argument to the function, while the second method would prepend this to the list. I can also use these methods for the default functions. Commented Feb 10, 2017 at 14:11