Example usage for org.apache.commons.collections4 TransformerUtils nullTransformer

List of usage examples for org.apache.commons.collections4 TransformerUtils nullTransformer

Introduction

In this page you can find the example usage for org.apache.commons.collections4 TransformerUtils nullTransformer.

Prototype

public static <I, O> Transformer<I, O> nullTransformer() 

Source Link

Document

Gets a transformer that always returns null.

Usage

From source file:com.feilong.core.util.CollectionsUtilTest.java

/**
 * Test collect.//w w  w . j a  va  2  s  . co m
 */
@Test
public void testCollect() {
    List<String> list = toList("xinge", "feilong1", "feilong2", "feilong2");

    Transformer<String, Object> nullTransformer = TransformerUtils.nullTransformer();
    List<Object> collect = CollectionsUtil.collect(list, nullTransformer);

    Object[] objects = { null, null, null, null };
    assertThat(collect, hasItems(objects));
}