There are classes Document , Element , Elements . I created the heir classes:
Source extends Document SourceElement extends Element SourceElements extends Elements Moreover, the Document class is a heir from Element , and Elements is a heir from ArrayList<Element> .
The Element class has a select method that Elements returns. But I need SourceElement .
How do I organize inheritance so that I can write my methods without any problems? For example, now I have to write the select method, which returns SourceElements , I have to perform castes. In addition, you cannot use the name of the select method. And I would love to.