List of usage examples for com.google.common.collect ImmutableList forEach
default void forEach(Consumer<? super T> action)
From source file:com.spectralogic.ds3contractcomparator.print.simpleprinter.Ds3AnnotationDiffSimplePrinter.java
/** * Gets the union of names of all params within two {@link ImmutableList} of {@link Ds3AnnotationElement} *//*from w ww . ja v a2s . c om*/ private static ImmutableSet<String> getAnnotationElementNameUnion( final ImmutableList<Ds3AnnotationElement> oldElements, final ImmutableList<Ds3AnnotationElement> newElements) { final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); if (hasContent(oldElements)) { oldElements.forEach(element -> builder.add(element.getName())); } if (hasContent(newElements)) { newElements.forEach(element -> builder.add(element.getName())); } return builder.build(); }
From source file:com.spectralogic.ds3contractcomparator.print.simpleprinter.Ds3ElementDiffSimplePrinter.java
/** * Converts an {@link ImmutableList} of {@link Ds3Annotation} into an {@link ImmutableMap} of * annotation names and {@link Ds3Annotation} *///w w w. ja v a 2 s.c o m private static ImmutableMap<String, Ds3Annotation> toAnnotationMap( final ImmutableList<Ds3Annotation> annotations) { if (isEmpty(annotations)) { return ImmutableMap.of(); } final ImmutableMap.Builder<String, Ds3Annotation> builder = ImmutableMap.builder(); annotations.forEach(annotation -> builder.put(annotation.getName(), annotation)); return builder.build(); }
From source file:com.spectralogic.ds3contractcomparator.print.simpleprinter.Ds3ElementDiffSimplePrinter.java
/** * Gets the union of names of all params within two {@link ImmutableList} of {@link Ds3Annotation} *//*w w w . j av a2 s. co m*/ private static ImmutableSet<String> getAnnotationNameUnion(final ImmutableList<Ds3Annotation> oldAnnotations, final ImmutableList<Ds3Annotation> newAnnotations) { final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); if (hasContent(oldAnnotations)) { oldAnnotations.forEach(annotation -> builder.add(annotation.getName())); } if (hasContent(newAnnotations)) { newAnnotations.forEach(annotation -> builder.add(annotation.getName())); } return builder.build(); }
From source file:com.spectralogic.ds3contractcomparator.print.simpleprinter.Ds3TypeDiffSimplePrinter.java
/** * Converts a {@link ImmutableList} of {@link Ds3Element} into an {@link ImmutableMap} of * element names and {@link Ds3Element}/*from ww w.j a v a 2 s.c om*/ */ private static ImmutableMap<String, Ds3Element> toElementMap(final ImmutableList<Ds3Element> elements) { if (isEmpty(elements)) { return ImmutableMap.of(); } final ImmutableMap.Builder<String, Ds3Element> builder = ImmutableMap.builder(); elements.forEach(element -> builder.put(element.getName(), element)); return builder.build(); }
From source file:cd.go.contrib.elasticagents.docker.DockerContainer.java
private static Map<String, String> parseEnvironmentVariables(ContainerInfo containerInfo) { ImmutableList<String> env = containerInfo.config().env(); Map<String, String> environmentVariables = new HashMap<>(); if (env != null) { env.forEach(e -> { String[] keyValue = e.split("="); if (keyValue.length == 2) { environmentVariables.put(keyValue[0], keyValue[1]); } else { environmentVariables.put(keyValue[0], null); }//from w w w . jav a 2 s . c o m }); } return environmentVariables; }
From source file:com.spectralogic.ds3contractcomparator.print.simpleprinter.Ds3RequestDiffSimplePrinter.java
/** * Converts an {@link ImmutableList} of {@link Ds3ResponseCode} into an {@link ImmutableMap} of * codes and {@link Ds3ResponseCode}/*from w w w .j a va 2s . c o m*/ */ private static ImmutableMap<Integer, Ds3ResponseCode> toCodeMap(final ImmutableList<Ds3ResponseCode> codes) { if (isEmpty(codes)) { return ImmutableMap.of(); } final ImmutableMap.Builder<Integer, Ds3ResponseCode> builder = ImmutableMap.builder(); codes.forEach(code -> builder.put(code.getCode(), code)); return builder.build(); }
From source file:com.spectralogic.ds3contractcomparator.print.simpleprinter.Ds3TypeDiffSimplePrinter.java
/** * Gets the union of names of all params within two {@link ImmutableList} of {@link Ds3Element} *//*from w w w.j a v a2 s. c o m*/ private static ImmutableSet<String> getElementNameUnion(final ImmutableList<Ds3Element> oldElements, final ImmutableList<Ds3Element> newElements) { final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); if (hasContent(oldElements)) { oldElements.forEach(element -> builder.add(element.getName())); } if (hasContent(newElements)) { newElements.forEach(element -> builder.add(element.getName())); } return builder.build(); }
From source file:com.spectralogic.ds3contractcomparator.print.simpleprinter.Ds3TypeDiffSimplePrinter.java
/** * Gets the union of names of all params within two {@link ImmutableList} of {@link Ds3EnumConstant} */// w w w.ja v a 2 s .c o m private static ImmutableSet<String> getEnumConstantNameUnion(final ImmutableList<Ds3EnumConstant> oldEnums, final ImmutableList<Ds3EnumConstant> newEnums) { final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); if (hasContent(oldEnums)) { oldEnums.forEach(enumConstant -> builder.add(enumConstant.getName())); } if (hasContent(newEnums)) { newEnums.forEach(enumConstant -> builder.add(enumConstant.getName())); } return builder.build(); }
From source file:com.spectralogic.ds3contractcomparator.print.htmlprinter.generators.row.ModifiedHtmlRowGenerator.java
/** * Gets the set of property values from a list of objects *///from w ww .j av a 2s .c o m static <T> ImmutableSet<String> getPropertyValues(final ImmutableList<T> list, final String property) { if (isEmpty(list)) { return ImmutableSet.of(); } final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); list.forEach(o -> { try { builder.add(BeanUtils.getProperty(o, property)); } catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { LOG.error("Cannot create property union of objects from class " + o.getClass().toString() + " using property " + property + ": " + e.getMessage(), e); } }); return builder.build(); }
From source file:com.spectralogic.ds3contractcomparator.print.simpleprinter.Ds3RequestDiffSimplePrinter.java
/** * Gets the union of response codes within two {@link ImmutableList} of {@link Ds3ResponseCode} *///from w w w.j a v a2s . c o m private static ImmutableSet<Integer> getResponseCodeUnion(final ImmutableList<Ds3ResponseCode> oldCodes, final ImmutableList<Ds3ResponseCode> newCodes) { final ImmutableSet.Builder<Integer> builder = ImmutableSet.builder(); if (hasContent(oldCodes)) { oldCodes.forEach(code -> builder.add(code.getCode())); } if (hasContent(newCodes)) { newCodes.forEach(code -> builder.add(code.getCode())); } return builder.build(); }