Skip to content

Refactored PreAllocatedArray.java into a static method#6120

Open
ArbaazKhan1 wants to merge 1 commit intoapache:mainfrom
ArbaazKhan1:accumulo-6083
Open

Refactored PreAllocatedArray.java into a static method#6120
ArbaazKhan1 wants to merge 1 commit intoapache:mainfrom
ArbaazKhan1:accumulo-6083

Conversation

@ArbaazKhan1
Copy link
Contributor

Closes issue #6083

I moved the new newPreallocatedList static method into LocalityGroupUtil, and updated the references from the original PreAllocatedArray class to the new method.

@DomGarguilo DomGarguilo added this to the 4.0.0 milestone Feb 10, 2026
}

@SuppressWarnings("unchecked")
public static <T> List<T> newPreallocatedList(int size) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be moved out of LocalityGroupUtil?

There's not really anything in this static method that's related to LocalityGroups.

Maybe it makes sense to have DataTypeUtil?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree that it shouldn't be in LocalityGroup but I wasn't too sure where else to put it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LocalityGroup seemed the best since it uses the method and it seemed a little redundant to create a new class just for this method

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could put it in a class named PreallocatedList with a single static method named create. Moving the informational naming from the static method to the class name. Then could call List<String> pl = PreallocatedList.create(10);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace PreAllocatedArray with a single static method

4 participants