Example usage for com.google.common.collect Lists transform

List of usage examples for com.google.common.collect Lists transform

Introduction

In this page you can find the example usage for com.google.common.collect Lists transform.

Prototype

@CheckReturnValue
public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function) 

Source Link

Document

Returns a list that applies function to each element of fromList .

Usage

From source file:org.caleydo.core.view.opengl.util.spline.TesselatedPolygons.java

public static Band band(List<Pair<Vec3f, Vec3f>> anchorPoints, int numberOfSplinePoints) {
    List<Vec3f> top = Lists.transform(anchorPoints, Pair.<Vec3f, Vec3f>mapFirst());
    top = Splines.spline3(top, numberOfSplinePoints);

    List<Vec3f> bottom = Lists.transform(anchorPoints, Pair.<Vec3f, Vec3f>mapSecond());
    bottom = Splines.spline3(bottom, numberOfSplinePoints);

    return new Band(top, bottom);
}

From source file:com.untitleddoc.cadencecalc.jaxrs.models.Crankset.java

public String displayValue() {
    final List<String> stooths = Lists.transform(tooths, String::valueOf);
    return getName() + " (" + String.join("-", stooths) + ")";
}

From source file:ru.runa.report.web.tag.ReportTypesIterator.java

private static List<String[]> getAllcategories(User user) {
    ReportService reportService = Delegates.getReportService();
    BatchPresentation batchPresentation = BatchPresentationFactory.REPORTS.createNonPaged();
    List<WfReport> definitions = reportService.getReportDefinitions(user, batchPresentation, false);
    return Lists.transform(definitions, new Function<WfReport, String[]>() {

        @Override/*w  w w . j  av  a2 s.  c  om*/
        public String[] apply(WfReport input) {
            return input.getCategories();
        }
    });
}

From source file:org.openhab.binding.neohub.internal.NeoStatProperty.java

/**
 * Gets binding strings.//  ww w .ja v  a  2s  .c o m
 * 
 * @return list of all possible binding strings.
 */
public static List<String> getBindings() {
    return Lists.transform(Arrays.asList(NeoStatProperty.values()), new Function<NeoStatProperty, String>() {

        @Override
        public String apply(NeoStatProperty property) {
            return property.binding;
        }
    });
}

From source file:ru.runa.wf.web.DefinitionCategoriesIterator.java

private static List<String[]> getAllCategories(User user) {
    DefinitionService definitionService = Delegates.getDefinitionService();
    BatchPresentation batchPresentation = BatchPresentationFactory.DEFINITIONS.createNonPaged();
    List<WfDefinition> definitions = definitionService.getProcessDefinitions(user, batchPresentation, false);
    return Lists.transform(definitions, new Function<WfDefinition, String[]>() {

        @Override//from   w w w. ja v a 2  s . c o  m
        public String[] apply(WfDefinition input) {
            return input.getCategories();
        }
    });
}

From source file:org.geoserver.wms.web.data.StyleFormatsModel.java

@Override
protected List<String> load() {
    List<StyleHandler> handlers = GeoServerApplication.get().getBeansOfType(StyleHandler.class);
    return Lists.transform(handlers, new Function<StyleHandler, String>() {
        @Nullable//from   w ww .j  a v a  2s.  co  m
        @Override
        public String apply(@Nullable StyleHandler styleHandler) {
            return styleHandler.getFormat();
        }
    });
}

From source file:org.apache.druid.query.filter.DimFilters.java

public static List<DimFilter> optimize(List<DimFilter> filters) {
    return filterNulls(Lists.transform(filters, new Function<DimFilter, DimFilter>() {
        @Override//  w  w  w.  j ava 2s. c  om
        public DimFilter apply(DimFilter input) {
            return input.optimize();
        }
    }));
}

From source file:org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils.java

public static List<String> urlDecode(final List<String> values) {
    return Lists.transform(values, FUNCTION);
}

From source file:com.onboard.domain.transform.DiscussionTransform.java

public static DiscussionDTO discussionToDiscussionDTOWithDetail(Discussion discussion) {
    DiscussionDTO discussionDTO = new DiscussionDTO();
    BeanUtils.copyProperties(discussion, discussionDTO);
    if (discussion.getComments() != null) {
        discussionDTO.setComments(/*ww w  . j  a  va 2 s .c  o  m*/
                Lists.transform(discussion.getComments(), CommentTransform.COMMENT_TO_DTO_FUNCTION));
    }
    if (discussion.getSubscribers() != null) {
        discussionDTO.setSubscribers(
                Lists.transform(discussion.getSubscribers(), UserTransform.USER_TO_USERDTO_FUNCTION));
    }
    if (discussion.getAttachments() != null) {
        discussionDTO.setAttachments(Lists.transform(discussion.getAttachments(),
                AttachmentTransform.ATTACHMENT_TO_ATTACHMENTDTO_FUNCTION));
    }
    return discussionDTO;
}

From source file:org.opendaylight.controller.sal.binding.yang.types.UnionDependencySort.java

public static List<ExtendedType> sort(final Set<TypeDefinition<?>> typeDefinitions) {
    if (typeDefinitions == null) {
        logger.error("Set of Type Definitions cannot be NULL!");
        throw new IllegalArgumentException("Set of Type Definitions " + "cannot be NULL!");
    }//from  w  w w.j  av  a 2s  .  co m

    final Set<ExtendedType> extUnionTypes = unionsFromTypeDefinitions(typeDefinitions);

    final Set<Node> unsorted = unionTypesToUnionNodes(extUnionTypes);

    final List<Node> sortedNodes = TopologicalSort.sort(unsorted);
    return Lists.transform(sortedNodes, new Function<Node, ExtendedType>() {
        @Override
        public ExtendedType apply(Node input) {
            return ((UnionNode) input).getUnionType();
        }
    });
}