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

com.redis.riot.file.MapToFieldFunction Maven / Gradle / Ivy

There is a newer version: 4.1.9
Show newest version
package com.redis.riot.file;

import java.util.Map;
import java.util.function.Function;

public class MapToFieldFunction implements Function, Object> {

	private final String key;

	private Object defaultValue = null;

	public MapToFieldFunction(String key) {
		this.key = key;
	}

	public void setDefaultValue(Object defaultValue) {
		this.defaultValue = defaultValue;
	}

	@Override
	public Object apply(Map t) {
		return t.getOrDefault(key, defaultValue);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy