README quickstart `Filtered<>` snippet compares `String.equals(long)` and ignores `Wallet.id() throws IOException`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- java
- Domain
- documentation
Research direction
Start with the README.md quickstart snippet at lines 38-44 and compare it with Wallet.id() in src/main/java/io/zold/api/Wallet.java at line 45. Verify the example handles the numeric id and declared IOException correctly, then confirm the iterator returns the matching wallet rather than failing; done means the documented snippet compiles and behaves as described.
Written by the indexing model from the issue text.
Description
The "All you need is this" snippet at README.md lines 38-44 builds a Filtered<> predicate that calls w.id() and asks it to equal the literal string "9999888877776666". Wallet.id() is declared in src/main/java/io/zold/api/Wallet.java line 45 as long id() throws IOException, so the example has two defects.
First, the predicate body never matches. "9999888877776666".equals(w.id()) autoboxes the primitive long to a Long, and String.equals(Long) returns false for every wallet in the directory. The iterator's next() call therefore throws NoSuchElementException instead of returning a wallet.
Second, the snippet does not compile as written. Wallet.id() declares throws IOException, but org.cactoos.iterable.Filtered takes a plain Func<X, Boolean>. A lambda that calls a method throwing a checked exception needs IoCheckedFunc or a wrapper, neither of which the example uses.
Smallest fix: drop the quotes, parse the id as hex, and either use IoCheckedFunc or replace Filtered with the cactoos iterable that tolerates IOException. For example:
final long target = Long.parseUnsignedLong("9999888877776666", 16);
final Wallet wallet = new Filtered<>(
new IoCheckedFunc<>(w -> w.id() == target),
wallets
).iterator().next();
That keeps the README example honest about both the id type and the checked exception surface.
- Dominant language
- Java
- Stars
- 22
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from zold-io/java-api
-
bug good first issue
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
bug help wanted
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
bug pdd
Difficulty 2/5 Under an hour Newbie friendliness 72/100
-
bug pdd
Difficulty 2/5 Under an hour Newbie friendliness 68/100
-
bug good first issue
Difficulty 4/5 3-5 days Newbie friendliness 45/100
All issues in zold-io/java-api
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100