@Override public Collection<Trophy> findByName(final String trophyName) { notNull(trophyName, "trophyName must not be null"); final List<Trophy> trophiesForName = new ArrayList<Trophy>(); trophiesLock.readLock().lock(); try { for (Trophy trophy : trophies.values()) { if (trophy.getName().equals(trophyName)) { trophiesForName.add(trophy); } } } finally { trophiesLock.readLock().unlock(); } return trophiesForName; }
@Override public Trophy findByNameAndGameType(final String name, final String gameType) { notNull(name, "Trophy name may not be null"); if (LOG.isDebugEnabled()) { LOG.debug("Entering find by name " + name); } trophiesLock.readLock().lock(); try { for (Trophy trophy : trophies.values()) { if (trophy.getGameType().equals(gameType) && trophy.getName().equals(name)) { return trophy; } } } finally { trophiesLock.readLock().unlock(); } return null; }