private V getFromFile(String file) throws NullPointerException {

        try {
            FileInputStream fileStream = new FileInputStream(file);
            ObjectInputStream objectStream = new ObjectInputStream(fileStream);
            V value = (V) objectStream.readObject();

            fileStream.close();
            objectStream.close();

            return value;
        } catch (IOException ex) {
            System.err.println(ex);
            return null;
        } catch (ClassNotFoundException ex) {
            System.err.println(ex);
            return null;
        } catch (NullPointerException ex) {
            throw new NullPointerException("File not exists");
        }
    }