Created
February 8, 2026 22:29
-
-
Save trikitrok/d8d2bbcbf4eb03ae77e175d453758257 to your computer and use it in GitHub Desktop.
Used to illustrate finding test points
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class InMemoryDirectory { | |
| private final List<Element> elements; | |
| public InMemoryDirectory() { | |
| this.elements = new ArrayList<>(); | |
| } | |
| public void addElement(Element newElement) { | |
| this.elements.add(newElement); | |
| } | |
| public void generateIndex() { | |
| Element index = new Element("index"); | |
| for (Element element : elements) { | |
| index.addText(element.getName() + "\n"); | |
| } | |
| this.addElement(index); | |
| } | |
| public int getElementCount() { | |
| return this.elements.size(); | |
| } | |
| public Element getElement(String name) { | |
| for (Element element : elements) { | |
| if (element.getName().equals(name)) { | |
| return element; | |
| } | |
| } | |
| return null; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment