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

io.polaris.core.map.CaseInsensitiveMap Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package io.polaris.core.map;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author Qt
 * @since 1.8
 */
public class CaseInsensitiveMap extends TransformMap {

	public CaseInsensitiveMap() {
		super(new LinkedHashMap<>(), key -> (K) (key instanceof CharSequence ? key.toString().toUpperCase() : key));
	}
	public CaseInsensitiveMap(boolean upperCase) {
		super(new LinkedHashMap<>(), upperCase ? key -> (K) (key instanceof CharSequence ? key.toString().toUpperCase() : key)
			: key -> (K) (key instanceof CharSequence ? key.toString().toLowerCase() : key));
	}

	public CaseInsensitiveMap(Map raw) {
		super(raw, key -> (K) (key instanceof CharSequence ? key.toString().toUpperCase() : key));
	}

	public CaseInsensitiveMap(Map raw, boolean upperCase) {
		super(raw, upperCase ? key -> (K) (key instanceof CharSequence ? key.toString().toUpperCase() : key)
			: key -> (K) (key instanceof CharSequence ? key.toString().toLowerCase() : key));
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy