public Player save(Player player) { sessionFactory.getCurrentSession().persist(player); if (findOne(player.getFirstName()) != null) { playerList.remove(findOne(player.getFirstName())); } playerList.add(player); // serialiseList(); return player; }
public Player findOne(String playerId) { syncListWithDB(); for (Player playerCurrent : playerList) if (playerCurrent.getFirstName().equals(playerId.replace("%20", " "))) return playerCurrent; return null; }