Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize code generation for add() #37

Closed
bmunkholm opened this issue Jun 20, 2012 · 0 comments
Closed

Optimize code generation for add() #37

bmunkholm opened this issue Jun 20, 2012 · 0 comments

Comments

@bmunkholm
Copy link
Contributor

In add() you might as well call insert() instead of duplicating the generated code:

public Phone add(String type, String number) {
try {
long position = size();

        insertString(0, position, type);
        insertString(1, position, number);
        insertDone();

        return cursor(position);
    } catch (Exception e) {
        throw addRowException(e);
    }

}

public Phone insert(long position, String type, String number) {
    try {
        insertString(0, position, type);
        insertString(1, position, number);
        insertDone();

        return cursor(position);
    } catch (Exception e) {
        throw insertRowException(e);
    }
@ghost ghost assigned nmihajlovski Jun 20, 2012
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants