List of usage examples for java.util Set stream
default Stream<E> stream()
From source file:co.runrightfast.core.utils.JmxUtils.java
static void registerMBeans(final String domain, final Set<MBeanRegistration<?>> mBeanRegistrations) { if (CollectionUtils.isEmpty(mBeanRegistrations)) { return;/*from w ww.j a v a 2 s . co m*/ } checkArgument(StringUtils.isNotBlank(domain)); mBeanRegistrations.stream() .forEach(reg -> registerApplicationMBean(domain, reg.getMbean(), reg.getClass())); }
From source file:com.uwsoft.editor.utils.runtime.EntityUtils.java
public static Vector2 getRightTopPoint(Set<Entity> entities) { if (entities.size() == 0) return null; Vector2 rightTopPoint = getPosition(entities.stream().findFirst().get()); for (Entity entity : entities) { TransformComponent transformComponent = ComponentRetriever.get(entity, TransformComponent.class); DimensionsComponent dimensionsComponent = ComponentRetriever.get(entity, DimensionsComponent.class); if (rightTopPoint.x < transformComponent.x + dimensionsComponent.width) { rightTopPoint.x = transformComponent.x + dimensionsComponent.width; }/*from ww w . j a va 2 s . com*/ if (rightTopPoint.y < transformComponent.y + dimensionsComponent.height) { rightTopPoint.y = transformComponent.y + dimensionsComponent.height; } } return rightTopPoint; }
From source file:com.uwsoft.editor.utils.runtime.EntityUtils.java
public static Vector2 getLeftBottomPoint(Set<Entity> entities) { if (entities.size() == 0) return null; Vector2 leftBottomPoint = getPosition(entities.stream().findFirst().get()); for (Entity entity : entities) { TransformComponent transformComponent = ComponentRetriever.get(entity, TransformComponent.class); if (leftBottomPoint.x > transformComponent.x) { leftBottomPoint.x = transformComponent.x; }//from ww w . ja v a 2s. c om if (leftBottomPoint.y > transformComponent.y) { leftBottomPoint.y = transformComponent.y; } } return leftBottomPoint; }
From source file:com.wrmsr.wava.basic.BasicLoopInfo.java
public static BasicLoopInfo build(Iterable<Basic> basics, Multimap<Name, Name> inputs, BasicDominatorInfo di) { Set<Name> loops = findBasicLoops(basics, di); SetMultimap<Name, Name> backEdges = findBasicBackEdges(basics, loops, di); SetMultimap<Name, Name> loopContents = loops.stream() .flatMap(loop -> getLoopContents(loop, inputs, backEdges).stream() .map(child -> ImmutablePair.of(loop, child))) .collect(toHashMultimap());/*www. j ava 2 s . c o m*/ Map<Name, Name> loopParents = getLoopParents(loopContents); return new BasicLoopInfo(loops, backEdges, loopContents, loopParents); }
From source file:com.o2d.pkayjava.editor.utils.runtime.EntityUtils.java
public static Vector2 getRightTopPoint(Set<Entity> entities) { if (entities.size() == 0) return null; Vector2 rightTopPoint = getPosition(entities.stream().findFirst().get()); for (Entity entity : entities) { TransformComponent transformComponent = ComponentRetriever.get(entity, TransformComponent.class); DimensionsComponent dimensionsComponent = ComponentRetriever.get(entity, DimensionsComponent.class); if (rightTopPoint.x < transformComponent.getX() + dimensionsComponent.width) { rightTopPoint.x = transformComponent.getX() + dimensionsComponent.width; }//from ww w . j av a 2 s . co m if (rightTopPoint.y < transformComponent.getY() + dimensionsComponent.height) { rightTopPoint.y = transformComponent.getY() + dimensionsComponent.height; } } return rightTopPoint; }
From source file:com.o2d.pkayjava.editor.utils.runtime.EntityUtils.java
public static Vector2 getLeftBottomPoint(Set<Entity> entities) { if (entities.size() == 0) return null; Vector2 leftBottomPoint = getPosition(entities.stream().findFirst().get()); for (Entity entity : entities) { TransformComponent transformComponent = ComponentRetriever.get(entity, TransformComponent.class); if (leftBottomPoint.x > transformComponent.getX()) { leftBottomPoint.x = transformComponent.getX(); }//from w ww . jav a2 s. co m if (leftBottomPoint.y > transformComponent.getY()) { leftBottomPoint.y = transformComponent.getY(); } } return leftBottomPoint; }
From source file:edu.wpi.checksims.util.threading.ParallelAlgorithm.java
/** * Remove common code in parallel.// w w w . j a v a 2 s.c om * * @param algorithm Algorithm to use for common code removal * @param common Common code to remove * @param submissions Submissions to remove from * @return Submissions with common code removed */ public static Set<Submission> parallelCommonCodeRemoval(SimilarityDetector algorithm, Submission common, Set<Submission> submissions) { checkNotNull(algorithm); checkNotNull(common); checkNotNull(submissions); Collection<CommonCodeRemovalWorker> workers = submissions.stream() .map((submission) -> new CommonCodeRemovalWorker(algorithm, common, submission)) .collect(Collectors.toList()); return ImmutableSet.copyOf(executeTasks(workers)); }
From source file:ddf.catalog.transformer.csv.common.CsvTransformer.java
public static List<AttributeDescriptor> sortAttributes(final Set<AttributeDescriptor> attributeSet, final List<String> attributeOrder) { CsvAttributeDescriptorComparator attributeComparator = new CsvAttributeDescriptorComparator(attributeOrder); return attributeSet.stream().sorted(attributeComparator).collect(toList()); }
From source file:it.jackbergus.graphdatabase.matrices.MatrixOp.java
/** * Matrix sum// www. j a v a 2 s .c o m * @param left * @param right * @return */ public static IMatrix sum(IMatrix left, IMatrix right) { Set<Pair<Long, Long>> iter = left.getValueRange(); iter.addAll(right.getValueRange()); IMatrix g = new GuavaMatrix(); iter.stream().forEach((x) -> { g.set(x, left.get(x) + right.get(x)); }); return g; }
From source file:it.jackbergus.graphdatabase.matrices.MatrixOp.java
/** * MAtrix difference//from ww w .j a va2 s. co m * @param left * @param right * @return */ public static IMatrix diff(IMatrix left, IMatrix right) { Set<Pair<Long, Long>> iter = left.getValueRange(); iter.addAll(right.getValueRange()); IMatrix g = new GuavaMatrix(); iter.stream().forEach((x) -> { g.set(x, left.get(x) - right.get(x)); }); return g; }