All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jn.langx.util.valuegetter.StreamValueGetter Maven / Gradle / Ivy

Go to download

Java lang extensions for java6+, a supplement to , replacement of a Guava, commons-lang. Core utilities, Collection utilities, IO utilities, Cache, Configuration library ...

There is a newer version: 4.8.2
Show newest version
package com.jn.langx.util.valuegetter;

import com.jn.langx.util.collection.Pipeline;
import com.jn.langx.util.function.Function;

import java.util.List;

public class StreamValueGetter implements ValueGetter> {
    private Function mapper;

    public StreamValueGetter(Function mapper){
        this.mapper = mapper;
    }

    public StreamValueGetter(final ValueGetter mapping){
        this.mapper = new Function() {
            @Override
            public O apply(Object input) {
                return (O)mapping.get(input);
            }
        };
    }


    @Override
    public List get(Object list) {
        return Pipeline.of(list).map(mapper).asList();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy