mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-28 15:02:46 +08:00

* modify code to make use of java Optional class * revert changes * add java.util.Optional<Integer> * add java.util.Optional * refactors: make `findmajor` return `optional` * refactors: make method name findMajor and split it * refactors: change method name in tests * Apply suggestions from code review Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com> * change back to int * fix: swap arguments * tests: add some test cases * refactor: add `isMajority` and avoid rounding * style: use `var` * style: swap arguments of `countOccurrences` --------- Co-authored-by: vil02 <vil02@o2.pl> Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>