commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <>
Subject [jira] [Commented] (MATH-1046) math3.stat.Frequency: Allow Null keys (comparable objects)
Date Thu, 24 Oct 2013 19:16:04 GMT


Thomas Neidhart commented on MATH-1046:

I don't think this will solve the "null" issue unless you stipulate a class/interface
to handle this issue (make it an Optional<T>?) 

No, but the interface of the addValue will change, allowing you to provide any type you specify
for the Frequency object, not only Comparable. Together with a custom Comparator it should
be more flexible.

btw. there is already a constructor which supports a Comparator, so we just need to update
the addValue(...) methods.

> math3.stat.Frequency: Allow Null keys (comparable objects)
> ----------------------------------------------------------
>                 Key: MATH-1046
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.2
>         Environment: Linux, JDK 7
>            Reporter: Hugo Ferrira
>            Priority: Trivial
>              Labels: features
>             Fix For: 3.2
> The class {{math3.stat.Frequency}} uses a {{TreeMap}} which does not allow
> for the use of null keys ({{public void addValue(Comparable<?> v)}} with {{v =
null}}). I am analyzing data (matrix) whose values may 
> contain nulls. I need to get the counts for elements in a given column.
> This includes knowing how many are null. This information will be used
> for data cleaning/pre-processing.
>  A simple change would be substituting {{TreeMap}} with {{java.util.HashMap<K,V>}}.

This message was sent by Atlassian JIRA

View raw message