Code example for MapMaker

Methods: makeMap

0
 
import com.google.common.collect.MapMaker;
 
public final class Prison { 
 
    private final Map<String, Set<Sponsor>> cells = new MapMaker().makeMap();
     
    public void imprison(Collection<Sponsor> criminals, Landscape crime) {
        cells.put(crime.name(), new HashSet<Sponsor>(criminals));
    } 
     
    public void paroleAllPrisonersFor(Landscape crime) {
        cells.remove(crime.name());
    } 
     
    public boolean crimeReported(Landscape crime) {
        return cells.containsKey(crime.name());
    } 
     
    public Set<Sponsor> prisonersFor(Landscape crime) {
Experience pair programming with AI  Get Codota for Java