And then ConsList<T> extends List<T>, Consable<T>, and all your internal logic that currently depends on ConsList can depend on Consable instead.
This leaves library users free to write their own list implementations (inheriting from Consable but not List), important since Java doesn't really have a workable immutable list implementation (but eg Functional Java does, even though it can't be used easily because of its abstract construction, annoying)
(Consable just needs head/tail in your internal logic I think? Doesn't need either Iterable or concat?)
And then
ConsList<T> extends List<T>, Consable<T>
, and all your internal logic that currently depends onConsList
can depend onConsable
instead.This leaves library users free to write their own list implementations (inheriting from
Consable
but notList
), important since Java doesn't really have a workable immutable list implementation (but eg Functional Java does, even though it can't be used easily because of its abstract construction, annoying)(
Consable
just needshead
/tail
in your internal logic I think? Doesn't need eitherIterable
orconcat
?)