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.apache.metron.stellar.common.utils.ConversionUtils.java

/**
 * Performs naive List type conversion.//from w  w  w .  ja  v a 2 s . c  o  m
 *
 * @param from Source list
 * @param clazz Class type to cast the List elements to
 * @param <T> Source element type
 * @param <U> Desired element type
 * @return New List with the elements cast to the desired type
 */
public static <T, U> List<U> convertList(List<T> from, Class<U> clazz) {
    return Lists.transform(from, s -> convert(s, clazz));
}

From source file:com.addthis.bundle.value.ValueArray.java

@Override
public default List<Object> asNative() {
    Function<ValueObject, Object> transformer = AsNative.INSTANCE;
    return Lists.transform(this, transformer);
}

From source file:io.druid.data.input.impl.DimensionsSpec.java

public static List<DimensionSchema> getDefaultSchemas(final List<String> dimNames,
        final DimensionSchema.MultiValueHandling multiValueHandling) {
    return Lists.transform(dimNames, new Function<String, DimensionSchema>() {
        @Override//from w  ww. java2 s. co m
        public DimensionSchema apply(String input) {
            return new StringDimensionSchema(input, multiValueHandling);
        }
    });
}

From source file:com.madvay.tools.android.perf.common.TraceTransformableTable.java

public void transformTraces(final TraceTransformers.TT tt) {
    setRows(Lists.transform(getRows(), new Function<T, T>() {
        @Override/*from w  ww . ja  va2  s .  co  m*/
        public T apply(T input) {
            return newRowWithTrace(input, tt.apply(input.getTransformableTrace()));
        }
    }));
}

From source file:org.axdt.as3.ui.templates.As3CrossReferenceTemplateVariableResolver.java

@Override
public List<String> resolveValues(TemplateVariable variable, XtextTemplateContext castedContext) {
    return Lists.transform(super.resolveValues(variable, castedContext), new Function<String, String>() {
        private int index;

        public String apply(String from) {
            return (index = from.lastIndexOf(".")) > 0 ? from.substring(index + 1) : from;
        }/*  ww w .j  a  v a 2s.c o m*/
    });
}

From source file:com.cloudera.exhibit.etl.SchemaProvider.java

public SchemaProvider(List<Schema> schemas) {
    this.schemas = schemas;
    this.json = Lists.newArrayList(Lists.transform(schemas, new Function<Schema, String>() {
        @Nullable/*w  ww  .  java 2s  .  c o m*/
        @Override
        public String apply(Schema schema) {
            return schema.toString();
        }
    }));
}

From source file:kuona.jenkins.analyser.model.JobWithDetails.java

public List<Build> getBuilds() {
    return Lists.transform(builds, this::buildWithClient);
}

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

public static BugDTO bugToBugDTO(Bug bug) {
    BugDTO bugDTO = new BugDTO();
    BeanUtils.copyProperties(bug, bugDTO);
    if (bug.getAssignee() != null && bug.getAssigneeId().equals(bug.getAssignee().getId())) {
        bugDTO.setBugAssigneeDTO(UserTransform.userToUserDTO(bug.getAssignee()));
    }//from ww w.j a v  a2s  .c  o  m
    if (bug.getSubscribers() != null) {
        bugDTO.setSubscribers(Lists.transform(bug.getSubscribers(), UserTransform.USER_TO_USERDTO_FUNCTION));
    }
    return bugDTO;
}

From source file:models.Nodelist.java

public static List<NodeContent> getKlist(Integer count) {
    List<NodeContent> r = null;
    try {/*  ww  w  .  j a va 2s.com*/
        // Long t24hAgo = 0l;
        // kQuery.append(CREATED, new BasicDBObject("$gt", t24hAgo)).
        DBCursor iobj = MongoDB.getDB().getCollection(MongoDB.CNode).find(kQuery).sort(kSort)
                .limit(count == null ? 100 : count);
        // query.append(fooks, new BasicDBObject("$notin", 1)); ?
        if (iobj != null)
            r = Lists.transform(iobj.toArray(), MongoDB.getSelf().toNodeContent());
    } catch (Exception ex) {
        Logger.info("getKlist");
        ex.printStackTrace();
        Logger.info(ex.toString());
    }
    return r;
}

From source file:c5db.log.OLogRawDataContent.java

private static List<ByteBuffer> sliceAll(List<ByteBuffer> buffers) {
    return Lists.transform(buffers, ByteBuffer::slice);
}