class BeatLoopSelector implements IBeatLoopSelector {

    @Override
    public IWeightableLoop selectByWeightAndBarCount(List<? extends IWeightableLoop> weightables, int maxBarCount) {

        List<IWeightableLoop> filteredByBarCount = new ArrayList<>();

        weightables.forEach(weightable -> {

            if(weightable.getBarCount() <= maxBarCount){
                filteredByBarCount.add(weightable);
            }
        });

        return selectByWeight(filteredByBarCount);
    }

}