Check if empty

This commit is contained in:
John Doe 2023-04-01 09:10:38 +02:00
parent 245ea095c2
commit 3d2066242f
1 changed files with 6 additions and 9 deletions

View File

@ -26,6 +26,12 @@ public class HockeyManager {
public void PrintNameAndAgeOfTheYoungestPlayer() {
if (player_list.isEmpty())
{
System.out.println("No players yet ");
return;
}
Collections.sort(player_list);
System.out.println(player_list.get(0).getName() + " " + player_list.get(0).getAge());
@ -43,17 +49,8 @@ public class HockeyManager {
System.out.println("Wins: " + ((Goalie) player_list.get(0)).getWins());
break;
default:
// code block
}
/*
for (Player item : player_list) {
System.out.println(item.name);
}
*/
}