class ChronicleMapConfiguration implements Serializable {

    private static final long serialVersionUID = -18408710536443827L;

    private static final Logger logger = Logger.getLogger(ChronicleMapConfiguration.class.getName());

    private static final String FILE_NAME_SUFFIX = "_map.cfg";

    private int entries;

    private double averageKeySize;

    public ChronicleMapConfiguration(final int entries, final double averageKeySize) {
        this.entries = entries;
        this.averageKeySize = averageKeySize;
    }

    public int getEntries() {
        return entries;
    }

    public double getAverageKeySize() {
        return averageKeySize;
    }

    public void setEntries(int entries) {
        this.entries = entries;
    }

    public void setAverageKeySize(double averageKeySize) {
        this.averageKeySize = averageKeySize;
    }

    /**
     * Stores this into a file.
     * @param dir directory where to store the file
     * @param field field this configuration is for
     */
    public void save(final Path dir, final String field) {
        try (FileOutputStream fos = new FileOutputStream(getFile(dir, field));
             ObjectOutputStream oos = new ObjectOutputStream(fos)) {
            oos.writeObject(this);
        } catch (IOException e) {
            logger.log(Level.SEVERE, "Could not save chronicle map configuration", e);
        }
    }

    /**
     * Loads configuration from file.
     * @param dir directory from which to load the configuration
     * @param field field this configuration is for
     * @return loaded configuration or {@code null} if this configuration could not be loaded
     */
    public static ChronicleMapConfiguration load(final Path dir, final String field) {<FILL_FUNCTION_BODY>}

    private static File getFile(final Path dir, final String field) {
        return dir.resolve(field + FILE_NAME_SUFFIX).toFile();
    }

}

        File f = getFile(dir, field);
        if (!f.exists()) {
            return null;
        }
        try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f))) {
            ois.setObjectInputFilter(filterInfo ->
                    filterInfo.serialClass() == null || filterInfo.serialClass() == ChronicleMapConfiguration.class ?
                            Status.ALLOWED : Status.REJECTED);
            return (ChronicleMapConfiguration) ois.readObject();
        } catch (IOException | ClassNotFoundException e) {
            logger.log(Level.SEVERE, "Could not load chronicle map configuration", e);
        }
        return null;
    
<no_super_class>