Example usage for java.util List forEach

List of usage examples for java.util List forEach

Introduction

In this page you can find the example usage for java.util List 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:org.manalith.ircbot.plugin.PluginManager.java

public void load(List<Plugin> plugins) {
    plugins.forEach(this::load);
}

From source file:io.dockstore.webservice.helpers.Helper.java

/**
 * Check if tool is null
 *
 * @param entry//from   ww w .j  a va2s  .c  o  m
 */
public static void checkEntry(List<? extends Entry> entry) {
    if (entry == null) {
        throw new CustomWebApplicationException("No entries provided", HttpStatus.SC_BAD_REQUEST);
    }
    entry.forEach(Helper::checkEntry);
}

From source file:org.obiba.mica.web.model.UserProfileDtos.java

@NotNull
public Mica.UserProfileDto asDto(ObibaRealm.Subject subject) {
    Mica.UserProfileDto.Builder builder = Mica.UserProfileDto.newBuilder().setUsername(subject.getUsername());
    List<String> groups = subject.getGroups();
    if (groups != null) {
        builder.addAllGroups(groups);//from ww w.  ja  va 2s  . com
    }

    List<Map<String, String>> attributes = subject.getAttributes();
    if (attributes != null) {
        attributes.forEach(attribute -> builder.addAttributes(Mica.UserProfileDto.AttributeDto.newBuilder()
                .setKey(attribute.get("key")).setValue(attribute.get("value"))));
    }

    return builder.build();
}

From source file:com.yqboots.security.web.support.RoleUsersHtmlOptionsResolver.java

/**
 * {@inheritDoc}//from ww  w  .  j  a v a  2  s .  co m
 */
@Override
public List<HtmlOption> getHtmlOptions(final String name, final String... attributes) {
    List<HtmlOption> results = new ArrayList<>();

    if (ArrayUtils.isNotEmpty(attributes) && attributes[0] != null) {
        // attributes[0] is path
        List<User> users = roleManager.findRoleUsers(attributes[0]);
        users.forEach(new UserToHtmlOptionConsumer(name, results));
    }

    return results;
}

From source file:com.yqboots.security.web.support.UserRolesHtmlOptionsResolver.java

/**
 * {@inheritDoc}/*from w w w . j  a  v a  2  s  . co  m*/
 */
@Override
public List<HtmlOption> getHtmlOptions(final String name, final String... attributes) {
    List<HtmlOption> results = new ArrayList<>();

    if (ArrayUtils.isNotEmpty(attributes) && attributes[0] != null) {
        // attributes[0] is username
        List<Role> roles = userManager.findUserRoles(attributes[0]);
        roles.forEach(new RoleToHtmlOptionConsumer(name, results));
    }

    return results;
}

From source file:com.mec.DAO.Postgre.EstablecimientoPostgreDAO.java

private List<EstablecimientoPost> lazyInit(List<EstablecimientoPost> establecimientos) {
    establecimientos.forEach((t) -> {
        init(t);/*www.j a  v  a2s  .c  o m*/
    });
    return establecimientos;
}

From source file:org.obiba.mica.core.upgrade.HarmonizationDatasetUpgrade.java

@Override
public void execute(Version version) {
    log.info("Executing harmonization datasets network tables upgrade");
    List<HarmonizationDataset> datasets = harmonizationDatasetRepository.findAll();

    datasets.forEach(dataset -> {
        int i = 0;
        for (StudyTable st : dataset.getStudyTables()) {
            st.setWeight(i++);//from  w w  w .  j a v  a2s .  c  o  m
        }
    });

    harmonizationDatasetRepository.save(datasets);

    eventBus.post(new IndexDatasetsEvent());
}

From source file:com.yqboots.security.web.support.GroupRolesHtmlOptionsResolver.java

/**
 * {@inheritDoc}//from   ww  w. j  a  v a  2s .c  o m
 */
@Override
public List<HtmlOption> getHtmlOptions(final String name, final String... attributes) {
    List<HtmlOption> results = new ArrayList<>();

    if (ArrayUtils.isNotEmpty(attributes) && attributes[0] != null) {
        // attributes[0] is path
        List<Role> roles = groupManager.findGroupRoles(attributes[0]);
        roles.forEach(new RoleToHtmlOptionConsumer(name, results));
    }

    return results;
}

From source file:com.yqboots.security.web.support.GroupUsersHtmlOptionsResolver.java

/**
 * {@inheritDoc}/* ww  w  .ja va 2s  . c o m*/
 */
@Override
public List<HtmlOption> getHtmlOptions(final String name, final String... attributes) {
    List<HtmlOption> results = new ArrayList<>();

    if (ArrayUtils.isNotEmpty(attributes) && attributes[0] != null) {
        // attributes[0] is path
        List<User> users = groupManager.findGroupUsers(attributes[0]);
        users.forEach(new UserToHtmlOptionConsumer(name, results));
    }

    return results;
}

From source file:de.qaware.cloud.deployer.marathon.config.resource.MarathonResourceConfigFactory.java

@Override
public List<MarathonResourceConfig> createConfigs(List<File> files) throws ResourceConfigException {
    LOGGER.info(MARATHON_MESSAGE_BUNDLE.getMessage("DEPLOYER_MARATHON_MESSAGE_READING_CONFIGS_STARTED"));
    List<MarathonResourceConfig> resourceConfigs = super.createConfigs(files);
    resourceConfigs.forEach(resourceConfig -> LOGGER.info(MARATHON_MESSAGE_BUNDLE
            .getMessage("DEPLOYER_MARATHON_MESSAGE_READING_CONFIGS_SINGLE_CONFIG", resourceConfig)));
    LOGGER.info(MARATHON_MESSAGE_BUNDLE.getMessage("DEPLOYER_MARATHON_MESSAGE_READING_CONFIGS_DONE"));
    return resourceConfigs;
}