1// Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file 2// for details. All rights reserved. Use of this source code is governed by a 3// BSD-style license that can be found in the LICENSE file. 4 5package com.android.tools.r8.utils; 6 7import java.util.ArrayList; 8import java.util.Collection; 9import java.util.List; 10import java.util.function.Function; 11 12public class ListUtils { 13 14 public static <S, T> List<T> map(Collection<S> list, Function<S, T> fn) { 15 List<T> result = new ArrayList<>(list.size()); 16 for (S element : list) { 17 result.add(fn.apply(element)); 18 } 19 return result; 20 } 21} 22