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

Eagerly initialize to-n ArrayLists #16

Open
Clashsoft opened this issue Dec 15, 2019 · 1 comment
Open

Eagerly initialize to-n ArrayLists #16

Clashsoft opened this issue Dec 15, 2019 · 1 comment
Labels
enhancement Changes to existing features suggestion Optional changes
Milestone

Comments

@Clashsoft
Copy link
Member

We can do away with the to-n association and attribute backing lists being nullable, and declare it initialized from the start:

private final java.util.ArrayList<Student> students = new java.util.ArrayList<>();

ArrayList creation is cheap, it does not even instantiate a backing array until the first element is added.

@Clashsoft Clashsoft added enhancement Changes to existing features suggestion Optional changes labels Dec 15, 2019
@azuendorf
Copy link
Contributor

Please measure the memory overhead that would be introduced by this change.

@Clashsoft Clashsoft added this to the v2 milestone Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Changes to existing features suggestion Optional changes
Projects
None yet
Development

No branches or pull requests

2 participants