Skip to content

Conversation

CHANMYUNG
Copy link
Contributor

I just simplified ArrayList construction.

	private static <E> Set<E> asUnmodifiableOrderedSet(Collection<E> elements) {
		List<E> list = new ArrayList<>();
		list.addAll(elements);
		list.sort(AnnotationAwareOrderComparator.INSTANCE);
		return new LinkedHashSet<>(list);
	}

it can be

	private static <E> Set<E> asUnmodifiableOrderedSet(Collection<E> elements) {
		List<E> list = new ArrayList<>(elements);
		list.sort(AnnotationAwareOrderComparator.INSTANCE);
		return new LinkedHashSet<>(list);
	}

And this change has a little profit to allocate memory

@pivotal-issuemaster
Copy link

@nooheat Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@nooheat Thank you for signing the Contributor License Agreement!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 31, 2018
@CHANMYUNG
Copy link
Contributor Author

whut??? I'm sorry to make failure.. :(
I don't know what to do.

@snicoll
Copy link
Member

snicoll commented Oct 31, 2018

@nooheat don’t you worry, this looks unrelated. Thanks for the PR!

@philwebb philwebb added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 31, 2018
@philwebb philwebb added this to the 2.0.x milestone Oct 31, 2018
@snicoll snicoll self-assigned this Nov 1, 2018
@snicoll snicoll modified the milestones: 2.0.x, 2.0.7 Nov 1, 2018
snicoll added a commit that referenced this pull request Nov 1, 2018
* pr/15033:
  Simplify ArrayList calling addAll() immediately
@snicoll snicoll closed this in 8380031 Nov 1, 2018
@snicoll
Copy link
Member

snicoll commented Nov 1, 2018

@nooheat thank you for making your first contribution to Spring Boot. This is now merged in 2.0.x and master.

@CHANMYUNG
Copy link
Contributor Author

OMG❗️❗️
Thanks for merge.

@CHANMYUNG CHANMYUNG deleted the simplify-arraylist-construction branch November 1, 2018 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants