Example usage for java.util Set forEach

List of usage examples for java.util Set forEach

Introduction

In this page you can find the example usage for java.util Set forEach.

Prototype

default void forEach(Consumer<? super T> action) 

Source Link

Document

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.

Usage

From source file:nu.yona.server.test.util.BaseSpringIntegrationTest.java

@Before
public final void setUpPerTestBase() {
    MockitoAnnotations.initMocks(this);

    Map<Class<?>, Repository<?, ?>> repositoriesMap = new HashMap<>();
    repositoriesMap.put(User.class, userRepository);
    repositoriesMap.put(UserAnonymized.class, userAnonymizedRepository);
    repositoriesMap.putAll(getRepositories());
    Set<CrudRepository<?, ?>> crudRepositories = filterForCrudRepositories(repositoriesMap.values());
    crudRepositories.forEach(CrudRepository::deleteAll);
    crudRepositories.stream().filter(this::isMock).forEach(r -> JUnitUtil.setUpRepositoryMock(r));
    JUnitUtil.setUpRepositoryProviderMock(repositoriesMap);
}

From source file:com.fredhopper.connector.index.populator.CategoryPopulator.java

private HashMap<Locale, String> mapNames(final CategoryModel category, final Set<Locale> locales) {
    final HashMap<Locale, String> namesMap = new HashMap<>();
    locales.forEach(locale -> namesMap.put(locale, category.getName(locale)));
    return namesMap;
}

From source file:com.netflix.genie.common.dto.ClusterCriteria.java

/**
 * Create a cluster criteria object with the included tags.
 *
 * @param tags The tags to add. Not null or empty and must have at least one non-empty tag.
 *///from  w w  w.  ja  v a2  s. co m
@JsonCreator
public ClusterCriteria(@JsonProperty("tags") final Set<String> tags) {
    final ImmutableSet.Builder<String> builder = ImmutableSet.builder();
    tags.forEach(tag -> {
        if (StringUtils.isNotBlank(tag)) {
            builder.add(tag);
        }
    });
    this.tags = builder.build();
}

From source file:cc.kave.commons.model.groum.SubGroum.java

public SubGroum(Groum parent, Set<Node> nodes) {
    this.parent = parent;
    nodes.forEach(node -> addNode(node));
}

From source file:com.zxy.commons.json.JsonTest.java

@Test
public void set() {
    Set<Jsons> objects = Sets.newHashSet(jsons);
    String setStr = JsonUtils.toJson(objects);
    System.out.println("setStr:" + setStr);

    Set<Jsons> set = JsonUtils.toSet(setStr, Jsons.class);
    set.forEach(obj -> System.out.println(obj.getStr1()));
    Assert.assertNotNull(set);//from   w w w.  j a v a2  s.c  o  m
}

From source file:com.abixen.platform.service.businessintelligence.multivisualization.util.impl.DataFileBuilderImpl.java

@Override
public DataFileBuilder data(Set<DataFileColumnDTO> dataColumn) {
    List<DataFileColumn> columns = new ArrayList<>();
    dataColumn.forEach(entity -> {
        DataFileColumn dataFileColumn = new DataFileColumn();
        dataFileColumn.setName(entity.getName());
        List<DataValue> values = new ArrayList<>();
        entity.getValues().forEach(child -> {
            if (child != null && child.getValue() != null) {
                String value = child.getValue().trim();
                DataValue dataValue = getObjForValue(value);
                dataValue.setDataColumn(dataFileColumn);
                values.add(dataValue);//from   ww  w.  j  a v  a  2  s.  c  om
            }
        });
        dataFileColumn.setValues(values);
        dataFileColumn.setDataFile(this.product);
        columns.add(dataFileColumn);
    });
    this.product.setColumns(columns);
    return this;
}

From source file:com.abixen.platform.service.businessintelligence.multivisualisation.util.impl.DataFileBuilderImpl.java

@Override
public DataFileBuilder data(Set<DataFileColumnDTO> dataColumn) {
    List<DataFileColumn> columns = new ArrayList<>();
    dataColumn.forEach(entity -> {
        DataFileColumn dataFileColumn = new DataFileColumn();
        dataFileColumn.setName(entity.getName());
        dataFileColumn.setPosition(entity.getPosition());
        dataFileColumn.setDataValueType(entity.getDataValueType());
        List<DataValue> values = new ArrayList<>();
        entity.getValues().forEach(child -> {
            if (child != null && child.getValue() != null) {
                String value = child.getValue().trim();
                DataValue dataValue = getObjForValue(value);
                dataValue.setDataColumn(dataFileColumn);
                values.add(dataValue);/* w w w . ja  v  a2s  . c om*/
            }
        });
        dataFileColumn.setValues(values);
        dataFileColumn.setDataFile(this.product);
        columns.add(dataFileColumn);
    });
    this.product.setColumns(columns);
    return this;
}

From source file:org.obiba.agate.web.rest.notification.NotificationsResource.java

/**
 * Send an email build with//from ww  w. ja  v  a2  s.c om
 * @param subject
 * @param body
 * @param recipients
 */
private void sendPlainEmail(String subject, String body, Set<User> recipients) {
    recipients.forEach(rec -> mailService.sendEmail(rec.getEmail(), subject, body));
}

From source file:co.mafiagame.telegraminterface.outputhandler.TelegramChannel.java

@Override
public void gameOver(Set<String> usernames) {
    usernames.forEach(roomContainer::remove);
}

From source file:org.wso2.carbon.transport.http.netty.util.TestUtil.java

public static List<HTTPServerConnector> startConnectors(TransportsConfiguration transportsConfiguration,
        CarbonMessageProcessor carbonMessageProcessor) {

    List<HTTPServerConnector> connectors = new ArrayList<>();

    ServerConnectorController serverConnectorController = new ServerConnectorController(
            transportsConfiguration);//from w w w  .j  av  a2  s  .c  o m

    Set<ListenerConfiguration> listenerConfigurationSet = transportsConfiguration.getListenerConfigurations();

    HTTPClientConnector httpClientConnector = new HTTPClientConnector(
            transportsConfiguration.getSenderConfigurations(),
            transportsConfiguration.getTransportProperties());

    HTTPTransportContextHolder.getInstance().setMessageProcessor(carbonMessageProcessor);

    carbonMessageProcessor.setClientConnector(httpClientConnector);

    Thread transportRunner = new Thread(() -> {
        try {
            serverConnectorController.start();
        } catch (Exception e) {
            log.error("Unable to start Server Connector Controller ", e);
        }
    });
    transportRunner.start();

    try {
        Thread.sleep(TestUtil.SERVERS_SETUP_TIME);
    } catch (InterruptedException e) {
        log.error("Thread Interrupted while sleeping ", e);
    }

    listenerConfigurationSet.forEach(config -> {
        HTTPServerConnector connector = new HTTPServerConnector(config.getId());
        connector.setListenerConfiguration(config);
        connector.setServerConnectorController(serverConnectorController);
        serverConnectorController.bindInterface(connector);
        connector.setMessageProcessor(carbonMessageProcessor);
        connectors.add(connector);
    });

    return connectors;
}