openrewrite / openrewrite/rewrite-apache

Apache collections: migrate from `cardinality(O obj, Iterable<? super O> coll)` to `IterableUtils.frequency(Iterable, Object)`

Open Beginner friendly
#37 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

recipe
Dominant language
Java
Stars
6
Forks
19
Avg merge
56m
Merged PRs (30d)
3

Description


cardinality(O obj, Iterable<? super O> coll)

Deprecated. since 4.1, use IterableUtils.frequency(Iterable, Object) instead. Be aware that the order of parameters has changed.

https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/CollectionUtils.html#cardinality-O-java.lang.Iterable-

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the Java recipes in this repository for calls to CollectionUtils.cardinality, then inspect the surrounding recipe tests. Replace the deprecated call with IterableUtils.frequency(Iterable, Object), accounting for the reversed parameter order, and run the relevant tests to confirm the migration.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.