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:domper.probe.android.service.Utils.java

static List<NamedValue> namedValueExtractor(Class<?> clazz) {
    return Lists.transform(RecordItemExtractor.extract(Build.class), recordItemToNamedValue);
}

From source file:com.yahoo.sql4d.utils.DruidUtils.java

public static List<String> getMetrics(List<AggItem> aggItems) {
    return Lists.transform(aggItems, new Function<AggItem, String>() {
        @Override//from  w  w  w.  ja  v  a2 s.  c o  m
        public String apply(AggItem f) {
            return f.fieldName;
        }
    });
}

From source file:org.sonar.db.purge.IdUuidPairs.java

public static List<String> uuids(List<IdUuidPair> pairs) {
    return Lists.transform(pairs, new IdUuidPairToUuidFunction());
}

From source file:com.meiste.greg.ptwgame.RefUtils.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> List<Ref<T>> ref(List<T> list) {
    return Lists.transform(list, (RefFunc) RefFunc.INSTANCE);
}

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

public static SearchResultDTO searchItemsToSearchResult(SearchResult searchResult) {
    SearchResultDTO searchResultDTO = new SearchResultDTO();
    searchResultDTO.setHasNext(searchResult.isHasNext());
    if (searchResult.getResults() != null) {
        searchResultDTO.setResults(Lists.newArrayList(
                Lists.transform(searchResult.getResults(), IndexDocumentTransForm.INDEXDOCUMENT_DTO_FUNCTION)));
    }//  www.j  av  a2  s  . c  o  m
    return searchResultDTO;
}

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

public static DepartmentDTO departmentAndUsersToDepartmentDTO(Department department, List<User> users) {
    DepartmentDTO departmentDTO = new DepartmentDTO();
    BeanUtils.copyProperties(department, departmentDTO);
    departmentDTO.setUsers(Lists.transform(users, UserTransform.USER_TO_USERDTO_FUNCTION));
    return departmentDTO;
}

From source file:org.javahispano.javaleague.server.dao.objectify.Deref.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> List<T> deref(List<Ref<T>> reflist) {
    if (reflist == null) {
        return null;
    }/*from ww w . j a  va2  s  .co  m*/

    return Lists.transform(reflist, (Func) Func.INSTANCE);
}

From source file:ivorius.ivtoolkit.tools.NBTTagLists.java

public static List<NBTTagCompound> compounds(final NBTTagList list) {
    return Lists.transform(Ranges.rangeList(0, list.tagCount()), new Function<Integer, NBTTagCompound>() {
        @Nullable/*from  w w  w  . j  a va  2 s. com*/
        @Override
        public NBTTagCompound apply(Integer input) {
            return list.getCompoundTagAt(input);
        }
    });
}

From source file:org.caleydo.view.info.dataset.internal.DataSetItems.java

public static Collection<IDataSetItem> create() {
    List<Pair<IDataSetItem, Integer>> items = ExtensionUtils.loadExtensions("org.caleydo.view.info.DataSetItem",
            new ExtensionLoader());
    items = new ArrayList<>(items); // mutable copy
    Collections.sort(items, Pair.<Integer>compareSecond());
    return Lists.transform(items, Pair.<IDataSetItem, Integer>mapFirst());
}

From source file:org.azolla.io.FileHelper.java

/**
 * @see org.azolla.io.FileHelper#allFiles(File)
 *///from w w w  .ja  va  2  s . com
public static List<String> allFilePaths(File file) {
    return Lists.transform(allFiles(file), new Function<File, String>() {
        @Override
        public String apply(File input) {
            try {
                return input.getCanonicalPath();
            } catch (IOException e) {
                return input.getAbsolutePath();
            }
        }
    });
}