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

Support sorting of primitive lists by indirect comparison. #908

Closed
vmzakharov opened this issue Jun 8, 2020 · 1 comment
Closed

Support sorting of primitive lists by indirect comparison. #908

vmzakharov opened this issue Jun 8, 2020 · 1 comment

Comments

@vmzakharov
Copy link
Contributor

The proposal is to add the following APIs on PrimitiveLists (in addition to the existing sortThis()):

  • PrimitiveList sortThis(PrimitiveComparator comparator)
  • <T> PrimitiveList sortThisBy(PrimitiveFunction<T> keyExtractor) // sorts by the natural order of the keys
  • <T> PrimitiveList sortThisBy(PrimitiveFunction<T> keyExtractor, Comparator<? super T> keyComparator)

Where PrimitiveComparator is a Single Abstract Method interface that looks like

public interface PrimitiveComparator
{
    int compare(primitive value1, primitive value2);
}

To support this a new sort implementation will be required.

@nikhilnanivadekar
Copy link
Contributor

This looks fine as a starting point. Please raise a PR. Thanks!

vmzakharov added a commit to vmzakharov/eclipse-collections that referenced this issue Jun 11, 2020
…mparison

Signed-off-by: vmzakharov <zakharov.vladimir.m@gmail.com>
vmzakharov added a commit to vmzakharov/eclipse-collections that referenced this issue Jun 11, 2020
…mparison

Signed-off-by: vmzakharov <zakharov.vladimir.m@gmail.com>
vmzakharov added a commit to vmzakharov/eclipse-collections that referenced this issue Jun 12, 2020
…mparison

Signed-off-by: vmzakharov <zakharov.vladimir.m@gmail.com>
vmzakharov added a commit to vmzakharov/eclipse-collections that referenced this issue Jun 13, 2020
…mparison

Signed-off-by: vmzakharov <zakharov.vladimir.m@gmail.com>
vmzakharov added a commit to vmzakharov/eclipse-collections that referenced this issue Jun 13, 2020
…mparison

Signed-off-by: vmzakharov <zakharov.vladimir.m@gmail.com>
donraab added a commit that referenced this issue Jun 14, 2020
Closes #908: Support sorting of primitive lists by indirect comparison
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

No branches or pull requests

2 participants