Java 8 AbstractMap - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 AbstractMap class.

This code example shows how to use the following methods:put, HashMap.put
 
public abstract class ConfigurationTest { 
    public abstract Configuration getConfig();
 
    public Map<String, Object> getTestValues() {
        HashMap<String, Object> result = new LinkedHashMap<String, Object>();
 
        result.put("integer", Integer.MIN_VALUE);
        result.put("string", "String Value");
        result.put("long", Long.MAX_VALUE);
        result.put("true-boolean", true);
        result.put("false-boolean", false);
        result.put("vector", new Vector(12345.67, 64, -12345.6789));
        result.put("list", Arrays.asList(1, 2, 3, 4, 5));
        result.put("42", "The Answer");
 
        return result;
    } 
 
    /** 
8
CodeRank
This code example shows how to use the following methods:isEmpty
        } 
        return count;
    } 
 
    public boolean isEmpty() { 
        return wrappedMap.isEmpty();
    } 
 
    public void clear() { 
        wrappedMap.clear();
    } 
 
    public SortedSet<String> remove(Object key) {
        return wrappedMap.remove(key);
    } 
 
    public Set<String> keySet() {
        return wrappedMap.keySet();
    } 
 
7
CodeRank
This code example shows how to use the following methods:putAll, firstKey
		} 
	} 
	 
	private void getMostFrequentOpenUDID() { 
		if (mReceivedOpenUDIDs.isEmpty() == false) {
			final TreeMap<String,Integer> sorted_OpenUDIDS = new TreeMap(new ValueComparator());
			sorted_OpenUDIDS.putAll(mReceivedOpenUDIDs);
         
			OpenUDID = sorted_OpenUDIDS.firstKey();
		} 
	} 
	 
	 
	private static String OpenUDID = null;
	private static boolean mInitialized = false; 
 
	/** 
	 * The Method to call to get OpenUDID 
	 * @return the OpenUDID 
	 */ 
7
CodeRank
This code example shows how to use the following methods:values
        } 
        return key;
    } 
 
    public Collection<S> getAllShardInfo() {
        return Collections.unmodifiableCollection(nodes.values());
    } 
 
    public Collection<R> getAllShards() {
        return Collections.unmodifiableCollection(resources.values());
    } 
} 
 
7
CodeRank
This code example shows how to use the following methods:put, put
 
import java.util.LinkedHashMap; 
 
public class QMFStatistic 
{ 
    private final LinkedHashMap<String,Object> _map = new LinkedHashMap<String,Object>();
    private static final String NAME = "name";
    private static final String TYPE = "type";
    private static final String UNIT = "unit";
    private static final String DESCRIPTION = "desc";
 
 
    public QMFStatistic(String name, QMFType type, String unit, String description)
    { 
        _map.put(NAME, name);
        _map.put(TYPE, type.codeValue());
        if(unit != null)
        { 
            _map.put(UNIT, unit);
        } 

7
CodeRank
This code example shows how to use the following methods:put, put
 
import java.util.LinkedHashMap; 
 
public class QMFStatistic 
{ 
    private final LinkedHashMap<String,Object> _map = new LinkedHashMap<String,Object>();
    private static final String NAME = "name";
    private static final String TYPE = "type";
    private static final String UNIT = "unit";
    private static final String DESCRIPTION = "desc";
 
 
    public QMFStatistic(String name, QMFType type, String unit, String description)
    { 
        _map.put(NAME, name);
        _map.put(TYPE, type.codeValue());
        if(unit != null)
        { 
            _map.put(UNIT, unit);
        } 

7
CodeRank
This code example shows how to use the following methods:isEmpty, ceilingKey, containsKey, firstKey, get
 
 
    private String findConsumerByPartition(final TreeMap<Long, String> consumerMap, final String partition) {
        final Long hash = this.alg.hash(partition);
        Long target = hash;
        if (!consumerMap.containsKey(hash)) {
            target = consumerMap.ceilingKey(hash);
            // if (hash == null) { 
            // target = consumerMap.floorKey(hash); 
            // } 
            // else { 
            // final Long floor = consumerMap.floorKey(hash); 
            // if (floor != null) { 
            // target = Math.abs(hash - floor) > Math.abs(hash - target) ? 
            // target : floor; 
            // } 
            // } 
            if (target == null && !consumerMap.isEmpty()) {
                target = consumerMap.firstKey();
            } 

7
CodeRank
This code example shows how to use the following methods:put, put
        Assert.assertEquals(1, imfs.readAll().size());
    } 
 
    @Test 
    public void testUnitFeatureInitialization2() { 
        LinkedHashMap<String, Feature> map1 = new LinkedHashMap<String, Feature>();
        map1.put("new", new Feature("new", true, "description"));
        map1.put("old", new Feature("old", true, "description"));
        InMemoryFeatureStore imfs = new InMemoryFeatureStore(map1);
        Assert.assertEquals(2, imfs.readAll().size());
        Assert.assertTrue(imfs.toString().contains("old"));
    } 
 
    @Test(expected = IllegalArgumentException.class) 
    public void testUnitFeatureInitialization3() { 
        new InMemoryFeatureStore("invalid.xml"); 
    } 
 
} 
7
CodeRank
This code example shows how to use the following methods:put, size, values, Map.put
        } 
        return false; 
    } 
 
    public final Param[] getParametersInfo() { 
        LinkedHashMap map = new LinkedHashMap();
        setupParameters(map);
 
        return (Param[]) map.values().toArray(new Param[map.size()]);
    } 
 
    void setupParameters(LinkedHashMap map) {
        map.put(URLP.key, URLP);
        map.put(HEADERROW.key, HEADERROW);
        map.put(LATCOL.key, LATCOL);
        map.put(LONGCOL.key, LONGCOL);
        map.put(SHEETNAME.key, SHEETNAME);
        map.put(PROJECTION.key, PROJECTION);
    } 
 

6
CodeRank
This code example shows how to use the following methods:hashCode, clone, get, put, size
See Code Examples for Java 8 AbstractMap Methods: