Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution for Generics 03 #64

Open
wants to merge 4 commits into
base: exercises/generics/03
Choose a base branch
from

Conversation

SteffenLm
Copy link
Contributor

No description provided.

SteffenLm and others added 4 commits August 19, 2023 14:20
* Update SchoolClass.java

In the loop condition, pupils.size() is re-evaluated in each iteration, and because the code removed pupils from the list inside the loop, the size of the list decreases with each iteration. This is not clean and because of this an exception occurred when trying to run the function with an even amount of pupils. 

Furthermore the if condition to check if the size of the array is 1 needed also to be inside the loop for this solution.

* Update Exercise.java

Add example for even pupils

* Use while loop

---------

Co-authored-by: SteffenLm <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants