You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Ruiqi Dong (Jira)" <ji...@apache.org> on 2025/07/24 05:01:00 UTC
[jira] [Updated] (MATH-1682) RealVector.sparseIterator() throws OutOfRangeException for empty vectors
[ https://issues.apache.org/jira/browse/MATH-1682?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ruiqi Dong updated MATH-1682:
-----------------------------
Priority: Critical (was: Minor)
> RealVector.sparseIterator() throws OutOfRangeException for empty vectors
> ------------------------------------------------------------------------
>
> Key: MATH-1682
> URL: https://issues.apache.org/jira/browse/MATH-1682
> Project: Commons Math
> Issue Type: Bug
> Components: legacy
> Reporter: Ruiqi Dong
> Priority: Critical
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> When calling {{sparseIterator()}} on an empty {{RealVector}} (dimension = 0), an {{OutOfRangeException}} is thrown instead of returning an empty iterator. This violates the expected behavior of iterator pattern where empty collections should return empty iterators.
> *Test Case:*
> {code:java}
> RealVector v = create(new double[0]);
> Iterator<Entry> it = v.sparseIterator();// Throws OutOfRangeException {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)