Browse Source
player_management: returns player from list if existing
player_management: returns player from list if existing
Tobias Krause
3 years ago
4 changed files with 30 additions and 15 deletions
-
14src/main/java/de/tims/player_management/Player.java
-
16src/main/java/de/tims/player_management/PlayerManager.java
-
11src/test/java/de/tims/player_management/PlayerManagerTest.java
-
4src/test/java/de/tims/player_management/PlayerTest.java
@ -1,21 +1,27 @@ |
|||
package de.tims.player_management; |
|||
|
|||
import java.util.LinkedList; |
|||
import java.util.List; |
|||
|
|||
public class PlayerManager { |
|||
|
|||
private LinkedList<Player> players; |
|||
private List<Player> players; |
|||
|
|||
public LinkedList<Player> getPlayers() { |
|||
public List<Player> getPlayers() { |
|||
return players; |
|||
} |
|||
|
|||
public void setPlayers(LinkedList<Player> players) { |
|||
public void setPlayers(List<Player> players) { |
|||
this.players = players; |
|||
} |
|||
|
|||
public Player selectPlayer(String playerName) { |
|||
return new Player(0); |
|||
for (Player p : this.players) { |
|||
if (playerName.equals(p.getName())) { |
|||
return p; |
|||
} |
|||
} |
|||
|
|||
return new Player(playerName, 0); |
|||
} |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue