Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[OTHER] Refactor: Standardize comparison logic using SortUtils #6336

Open
@codingmydna

Description

@codingmydna

What would you like to share?

This issue proposes a refactoring to standardize the comparison logic across various sorting algorithms in thesorts directory.

Currently, some sorting algorithm implementations directly useComparable.compareTo() for element comparisons (e.g.,array[i].compareTo(array[j]) > 0), while others utilize the utility methods provided bySortUtils (e.g.,SortUtils.greater(array[i], array[j])).

The goal of this refactoring is to replace directcompareTo() calls with the correspondingSortUtils.less(),SortUtils.greater(), orSortUtils.greaterOrEqual() methods where applicable.

Additional information

I have identified the following files that currently use directcompareTo() calls and can be refactored:

  • AdaptiveMergeSort.java
  • BinaryInsertionSort.java
  • BitonicSort.java
  • BucketSort.java (partial, wherecompareTo is used for boolean comparison)
  • CircleSort.java
  • DutchNationalFlagSort.java
  • ExchangeSort.java
  • FlashSort.java (partial, wherecompareTo is used for boolean comparison)
  • IntrospectiveSort.java
  • OddEvenSort.java
  • SelectionSort.java
  • SelectionSortRecursive.java
  • StalinSort.java
  • StrandSort.java
  • WiggleSort.java (partial, wherecompareTo is used for boolean comparison)

(Note: Files likeCycleSort.java,PatienceSort.java,SpreadSort.java that usecompareTo() for equality checks or value calculations will not be modified, asSortUtils does not provide direct equivalents for these specific use cases.)

I am willing to create a Pull Request to implement this refactoring.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp