List of usage examples for java.util.stream Collectors toList
public static <T> Collector<T, ?, List<T>> toList()
From source file:com.github.dozermapper.core.builder.model.elengine.ELMappingDefinition.java
public ELMappingDefinition(ELEngine elEngine, MappingDefinition copy) { this(elEngine, (MappingsDefinition) null); if (copy != null) { this.classA = new ELClassDefinition(elEngine, copy.getClassA()); this.classB = new ELClassDefinition(elEngine, copy.getClassB()); if (copy.getFieldOrFieldExclude() != null && copy.getFieldOrFieldExclude().size() > 0) { this.fieldOrFieldExclude = copy.getFieldOrFieldExclude().stream() .map(f -> f instanceof FieldDefinition ? new ELFieldDefinition(elEngine, (FieldDefinition) f) : f)/* w ww. j av a2s. co m*/ .collect(Collectors.toList()); } this.dateFormat = copy.getDateFormat(); this.stopOnErrors = copy.getStopOnErrors(); this.wildcard = copy.getWildcard(); this.wildcardCaseInsensitive = copy.getWildcardCaseInsensitive(); this.trimStrings = copy.getTrimStrings(); this.mapNull = copy.getMapNull(); this.mapEmptyString = copy.getMapEmptyString(); this.beanFactory = copy.getBeanFactory(); this.type = copy.getType(); this.relationshipType = copy.getRelationshipType(); this.mapId = copy.getMapId(); } }
From source file:com.capitalone.dashboard.evaluator.LibraryPolicyEvaluator.java
@Override public Collection<LibraryPolicyAuditResponse> evaluate(Dashboard dashboard, long beginDate, long endDate, Map<?, ?> data) throws AuditException { List<CollectorItem> libraryPolicyItems = getCollectorItems(dashboard, "codeanalysis", CollectorType.LibraryPolicy); if (CollectionUtils.isEmpty(libraryPolicyItems)) { throw new AuditException("No library policy project configured", AuditException.NO_COLLECTOR_ITEM_CONFIGURED); }/* w ww . j a v a 2s .com*/ return libraryPolicyItems.stream().map(item -> evaluate(item, beginDate, endDate, null)) .collect(Collectors.toList()); }
From source file:com.netflix.spinnaker.front50.model.PipelineBucketDAO.java
@Override public Collection<Pipeline> getPipelinesByApplication(String application) { return all().stream().filter(pipeline -> pipeline.getApplication().equalsIgnoreCase(application)) .collect(Collectors.toList()); }
From source file:com.epam.ta.reportportal.core.acl.chain.UserFilterChainElement.java
@Override public void saveElements(List<? extends Shareable> elementsToProcess) { userFilterRepository.save(elementsToProcess.stream().map(i -> (UserFilter) i).collect(Collectors.toList())); }
From source file:com.eretailservice.security.BookingRestController.java
@RequestMapping(method = RequestMethod.GET) Resources<BookingResource> readBookings(Principal principal) { this.validateUser(principal); List<BookingResource> bookingResourceList = bookingRepository.findByAccountUsername(principal.getName()) .stream().map(BookingResource::new).collect(Collectors.toList()); return new Resources<>(bookingResourceList); }
From source file:com.zuoxiaolong.niubi.job.persistent.BaseDaoImpl.java
@Override public <T> List<String> save(List<T> entityList) { List<String> idList = new ArrayList<>(); Session session = getHibernateSession(); idList.addAll(//from w w w.j a v a2s. c o m entityList.stream().map(entity -> (String) session.save(entity)).collect(Collectors.toList())); return idList; }
From source file:com.migo.shiro.UserRealm.java
/** * ?(???)// w w w . j av a 2 s . com */ @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { SysUserEntity user = (SysUserEntity) principalCollection.getPrimaryPrincipal(); Long userId = user.getUserId(); List<String> permsList; //??? if (userId == 1) { List<SysMenuEntity> menuList = sysMenuService.queryList(new HashMap<>()); permsList = menuList.stream().parallel().map(SysMenuEntity::getPerms).collect(Collectors.toList()); /*permsList = new ArrayList<>(menuList.size()); for(SysMenuEntity menu : menuList){ permsList.add(menu.getPerms()); }*/ } else { permsList = sysUserService.queryAllPerms(userId); } //?? /* Set<String> permsSet = new HashSet<>(); for(String perms : permsList){ if(StringUtils.isBlank(perms)){ continue; } permsSet.addAll(Arrays.asList(perms.trim().split(","))); }*/ Set<String> permsSet = permsList.stream().parallel().filter(StringUtils::isNotBlank).map(String::trim) .map(s -> s.split(",")).map(Arrays::asList).flatMap(Collection::stream).collect(Collectors.toSet()); SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); info.setStringPermissions(permsSet); return info; }
From source file:com.github.ambry.commons.BlobIdTest.java
/** * Running for both {@link BlobId#BLOB_ID_V1} and {@link BlobId#BLOB_ID_V2} * @return an array with both {@link BlobId#BLOB_ID_V1} and {@link BlobId#BLOB_ID_V2} *//*from w ww. j a v a 2 s .c o m*/ @Parameterized.Parameters public static List<Object[]> data() { return Arrays.stream(BlobId.getAllValidVersions()).map(version -> new Object[] { version }) .collect(Collectors.toList()); }
From source file:org.ow2.proactive.procci.service.CloudAutomationInstanceClient.java
/** * Give the list of models saved in cloud-automation * @return a list of Model//from w ww .jav a2 s . c om */ public List<Model> getModels() { JSONObject jsonModels = requestUtils.getRequest(requestUtils.getProperty(PCA_INSTANCES_ENDPOINT)); return (List<Model>) jsonModels.values().stream().map(jsonModel -> new Model((JSONObject) jsonModel)) .collect(Collectors.toList()); }
From source file:com.thinkbiganalytics.util.ColumnSpec.java
public static String toPrimaryKeyJoinSQL(ColumnSpec[] specs, String leftTableAlias, String rightTableAlias) { final String safeLeftTable = HiveUtils.quoteIdentifier(leftTableAlias); final String safeRightTable = HiveUtils.quoteIdentifier(rightTableAlias); final List<String> keys = Stream.of(specs).filter(ColumnSpec::isPk).map(ColumnSpec::getName) .map(HiveUtils::quoteIdentifier) .map(column -> safeLeftTable + "." + column + " = " + safeRightTable + "." + column) .collect(Collectors.toList()); return StringUtils.join(keys, " AND "); }