java-fundamentals-exercises
java-fundamentals-exercises copied to clipboard
Training Exercises that cover language basics, Algorithms, Data Structures, OOP, and Functional Programming
This pull request is created in order to discuss the completed solution of the exercises. Feel free to ask any questions by adding comments to the PR ➕
**The main goal of this exercise is to introduce threads and let people get their hands dirty with concurrent code.** It should be an **entry-level exercise** that does not require...
Tests are passing if the size is always 0.
I believe it's pretty self-explanatory. The first step would be to do the research in order to understand the tree details and implement the tree. **Once we have a raw...
https://github.com/bobocode-projects/java-fundamentals-course/blob/8a799b109e29ebad9e13854a9e04c3843bf68a62/1-0-java-basics/1-3-1-crazy-generics/src/main/java/com/bobocode/basics/CrazyGenerics.java#L95
5-0-2-stream-sum-of-squares exercise in branch completed doesn't contain an answer.
Better answers
The broken code: ``` public static boolean hasDuplicates(List entities, T targetEntity) { return entities.stream() .map(BaseEntity::getUuid) .distinct() .count() != entities.size(); } ``` This code doesn't check if the target entity is...
The corrupted code: ``` @Override public boolean contains(T element) { requireNonNull(element); Node current = head; if(!isEmpty()){ while (current.next != null){ if (current.element.equals(element)){ return true; } current = current.next; } }...
The next broken code is accepted: ``` @Override public T remove(int index) { checkIndex(index, size); if (index == 0) { return removeHead(); } else if (index == size - 1)...