import com.github.underscore.U; public class UnderscoreDemo { public static void main(String[] args) { List<String> words = Arrays.asList("apple", "banana", "cherry", "date"); List<String> upperCaseWords = U.map(words, String::toUpperCase); List<String> filteredWords = U.filter(upperCaseWords, word -> word.length() > 5); U.each(filteredWords, System.out::println); Function<String, Integer> toLength = String::length; Function<Integer, String> toString = Object::toString; Function<String, String> composed = U.compose(toString, toLength); } }


上一篇:
下一篇:
切换中文