News for hackers. Stuff that matters.
Re:The visitor pattern is essentially the same thing as Chur... by Twisol on Thursday February 04, 2021 @07:02AM (#26024638)
Sure. Then, if you're set on using lambdas, I'd recommend this, to at least take away the ability to choose <T> from the caller.

    static Shape<?> Circle(int x, int y, int r) {
      return (circle, rectangle) -> circle.apply(x, y, r);
    }
    static Shape<?> Rectangle(int x, int y, int w, int h) {
      return (circle, rectangle) -> rectangle.apply(x, y, w, h);
    }

There are no comments on this comment yet.