Code example for Splitter

Methods: split

0
    public List<Bet> findAll() { 
        return new ArrayList<Bet>(bets.values());
    } 
 
    private PlayerBet deserialize(String line) {
        ImmutableList<String> pieces = ImmutableList.copyOf(splitter.split(line));
        return new PlayerBet(Integer.valueOf(pieces.get(0)), new Bet(pieces.get(1), Integer.valueOf(pieces.get(2)), Integer.valueOf(pieces.get(3))));
    } 
 
    private String serialize(int id, Bet bet) {
        return id + ":" + bet.getPlayer() + ":" + bet.getGame() + ":" + bet.getAmount() + "\n";
    } 
 
    private void persist(int id, Bet bet) {
        bets.put(id, bet);
        try { 
            Files.append(serialize(id, bet), store, Charsets.UTF_8);
        } catch (IOException e) {
            e.printStackTrace();
        }