Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1D5E710FAA for ; Thu, 24 Oct 2013 19:16:24 +0000 (UTC) Received: (qmail 69152 invoked by uid 500); 24 Oct 2013 19:16:19 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 68582 invoked by uid 500); 24 Oct 2013 19:16:10 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 68469 invoked by uid 99); 24 Oct 2013 19:16:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Oct 2013 19:16:04 +0000 Date: Thu, 24 Oct 2013 19:16:04 +0000 (UTC) From: "Thomas Neidhart (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (MATH-1046) math3.stat.Frequency: Allow Null keys (comparable objects) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MATH-1046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13804569#comment-13804569 ] Thomas Neidhart commented on MATH-1046: --------------------------------------- {quote} I don't think this will solve the "null" issue unless you stipulate a class/interface to handle this issue (make it an Optional?) {quote} 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: https://issues.apache.org/jira/browse/MATH-1046 > 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}}. -- This message was sent by Atlassian JIRA (v6.1#6144)