Code example for SortedMap

Methods: get, put

0
{ 
    // Index interface 
 
    public boolean add(long z, SpatialObject spatialObject) 
    { 
        Set<SpatialObject> spatialObjects = map.get(z); 
        if (spatialObjects == null) { 
            spatialObjects = new HashSet<>(); 
            map.put(z, spatialObjects); 
        } 
        return spatialObjects.add(spatialObject); 
    } 
 
    public boolean remove(long z, SpatialObject spatialObject) 
    { 
        boolean removed = false; 
        Set<SpatialObject> spatialObjects = map.get(z); 
        if (spatialObjects != null && spatialObjects.remove(spatialObject)) { 
            removed = true; 
            if (spatialObjects.isEmpty()) { 
Stop searching for code, let great code find you!  Add Codota to your java IDE