<commit_before>package com.sg.java8.training.predicate.service;

import com.sg.java8.training.model.Product;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * A simple service for managing {@link Product} entities
 *
 * @author bogdan.solga
 */
public class ProductService {

    private static final List<Product> PRODUCTS = new ArrayList<>();

    static {
        PRODUCTS.add(new Product(1, "Nexus 7 2012", 200));
        PRODUCTS.add(new Product(2, "Nexus 7 2013", 300));
        PRODUCTS.add(new Product(3, "Nexus 10 2013", 350));
        PRODUCTS.add(new Product(4, "Nexus 7 2016", 400));

        PRODUCTS.add(new Product(5, "Samsung S2", 340));
        PRODUCTS.add(new Product(6, "Samsung S6", 500));
    }

    public List<Product> getNexusTablets() {
        return PRODUCTS.stream()
                       .filter(product -> product.getName().toLowerCase().contains("nexus"))
                       .collect(Collectors.toList());
    }
}<commit_msg>[improve] Refactored and cleaned the default store bootstrapping, added multiple characteristics to it<commit_after>package com.sg.java8.training.predicate.service;

import com.sg.java8.training.model.Manager;
import com.sg.java8.training.model.Product;
import com.sg.java8.training.model.Section;
import com.sg.java8.training.model.Store;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;

/**
 * A simple service for managing {@link Product} entities
 *
 * @author bogdan.solga
 */
public class ProductService {

    private static Store STORE;

    static {
        final Section tabletsSection = new Section(1, "Tablets", buildDefaultTablets());
        final Section monitorsSection = new Section(1, "Monitors", buildDefaultMonitors());

        final Manager john = new Manager(1, "<NAME>");
        final Manager jane = new Manager(2, "<NAME>");

        STORE = new Store(1, "eMag", "Over there",
                new HashSet<>(Arrays.asList(tabletsSection, monitorsSection)),
                new HashSet<>(Arrays.asList(john, jane)));
    }

    public List<Product> getNexusTablets() {
        final Section tablets = STORE.getStoreSections()
                                     .stream()
                                     .filter(section -> section.getSectionName().equals("Tablets"))
                                     .findFirst()
                                     .orElseThrow(() -> new IllegalArgumentException("There's no section named 'Tablets'"));

        return tablets.getProducts()
                      .stream()
                      .filter(product -> product.getName().toLowerCase().contains("nexus"))
                      .collect(Collectors.toList());
    }

    private static List<Product> buildDefaultTablets() {
        final List<Product> tablets = new ArrayList<>();

        tablets.add(new Product(1, "Google Nexus 7 2013", 200));
        tablets.add(new Product(2, "Apple Ipad Pro 9.7", 300));
        tablets.add(new Product(3, "Samsung Galaxy Tab S2", 350));
        tablets.add(new Product(4, "Microsoft Surface Pro 4", 400));

        return tablets;
    }

    private static List<Product> buildDefaultMonitors() {
        final List<Product> monitors = new ArrayList<>();

        monitors.add(new Product(5, "Samsung CF791", 500));
        monitors.add(new Product(6, "LG 32UD99", 550));
        monitors.add(new Product(6, "Samsung CH711", 600));

        return monitors;
    }
}
{'fraction_non_alphanumeric': 0.12800906258850184, 'fraction_numerical': 0.030019824412347778, 'mean_word_length': 2.65253360910031, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3321175', 'n_tokens_mistral': 1109, 'n_tokens_neox': 991, 'n_words': 250}