<commit_before>package com.blackfriar;

import com.blackfriar.domain.Beer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * Created by paulwatson on 06/03/2016.
 */
@Service
public class BeerServiceImpl implements BeerService {

    private static List<Beer> beers = new ArrayList<Beer>();

    static {

        Beer anchorSteam = new Beer();
        anchorSteam.setId(1L);
        anchorSteam.setName("Anchor Steam");
        anchorSteam.setPrice(10L);

        beers.add(anchorSteam);
    }

    @Autowired
    BeerRepository beerRepository;


    @Override
    public List<Beer> getAllBeers() {
        List<Beer> beers = new ArrayList<>();
        beerRepository.findAll().forEach(beers::add);
        return beers;
    }

    @Override
    public Optional<Beer> getById(Long id) {
        List<Beer> beers = new ArrayList<>();
        beerRepository.findAll().forEach(beers::add);
        return beers.stream()
                .filter(b -> Objects.equals(b.getId(), id))
                .findAny();

    }
}<commit_msg>Remove hard coded data<commit_after>package com.blackfriar;

import com.blackfriar.domain.Beer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * Created by paulwatson on 06/03/2016.
 */
@Service
public class BeerServiceImpl implements BeerService {

    @Autowired
    BeerRepository beerRepository;


    @Override
    public List<Beer> getAllBeers() {
        List<Beer> beers = new ArrayList<>();
        beerRepository.findAll().forEach(beers::add);
        return beers;
    }

    @Override
    public Optional<Beer> getById(Long id) {
        return Optional.ofNullable(beerRepository.findOne(id));
    }
}
{'fraction_non_alphanumeric': 0.1162046908315565, 'fraction_numerical': 0.010127931769722815, 'mean_word_length': 3.1526548672566372, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2770316', 'n_tokens_mistral': 594, 'n_tokens_neox': 558, 'n_words': 116}