Skip to content

Use Comparator factory methods.#8728

Merged
Stypox merged 3 commits intoTeamNewPipe:devfrom
Isira-Seneviratne:Comparator_factory
Aug 6, 2022
Merged

Use Comparator factory methods.#8728
Stypox merged 3 commits intoTeamNewPipe:devfrom
Isira-Seneviratne:Comparator_factory

Conversation

@Isira-Seneviratne
Copy link
Copy Markdown
Member

@Isira-Seneviratne Isira-Seneviratne commented Aug 3, 2022

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Simplify audio and video stream comparisons using the Comparator factory methods.
  • Use Comparator.comparingDouble() in the preference search to avoid boxing.

Fixes the following issue(s)

  • Fixes #

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

Due diligence

@Isira-Seneviratne Isira-Seneviratne marked this pull request as ready for review August 3, 2022 00:51
@AudricV AudricV added the code quality Improvements to the codebase to improve the code quality label Aug 3, 2022
Copy link
Copy Markdown
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Code looks good to me

* @throws IllegalArgumentException if the term or query is {@code null}
*/
public Integer fuzzyScore(final CharSequence term, final CharSequence query) {
public int fuzzyScore(final CharSequence term, final CharSequence query) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this was taken from here. Does the apache license allow modifying code? If so, does it require changes to be documented?

Copy link
Copy Markdown
Member Author

@Isira-Seneviratne Isira-Seneviratne Aug 5, 2022

Choose a reason for hiding this comment

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

I undid the change, just in case.

Comment thread app/src/main/java/org/schabi/newpipe/util/ListHelper.java Outdated
Copy link
Copy Markdown
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

I tested the download dialog, also ListHelper tests pass, so this is fine

@Stypox Stypox merged commit 80fb21e into TeamNewPipe:dev Aug 6, 2022
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Aug 6, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Isira-Seneviratne Isira-Seneviratne deleted the Comparator_factory branch August 6, 2022 10:42
@Stypox Stypox mentioned this pull request Aug 27, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Improvements to the codebase to improve the code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants