class ConditionBuilder {

    public ConditionList buildQueryConditions(List<Segment> filtered) {
        // For top level , it will join all condition lists
        ConditionList providers = ConditionList.andList();
        
        List<Segment> conditionList = new ArrayList<>();
        for(Segment entry: filtered) {
            if(isConditionCandidate(entry)) {
                conditionList.add(entry);
            } else {
                parseCondition(providers, conditionList);
            }
        }

        //For the potential last one
        parseCondition(providers, conditionList);

        return providers;

    }

}