From issues-return-70896-archive-asf-public=cust-asf.ponee.io@commons.apache.org Fri Nov 30 23:06:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 9ED8418077A for ; Fri, 30 Nov 2018 23:06:04 +0100 (CET) Received: (qmail 1325 invoked by uid 500); 30 Nov 2018 22:06:03 -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 1048 invoked by uid 99); 30 Nov 2018 22:06:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2018 22:06:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id F10ECD1725 for ; Fri, 30 Nov 2018 22:06:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id mW1fU0ZbdzSg for ; Fri, 30 Nov 2018 22:06:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 40B0B5F67B for ; Fri, 30 Nov 2018 22:06:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id ABF94E1013 for ; Fri, 30 Nov 2018 22:06:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 491F224DD5 for ; Fri, 30 Nov 2018 22:06:00 +0000 (UTC) Date: Fri, 30 Nov 2018 22:06:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (COLLECTIONS-707) New collection type: PrefixMap 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/COLLECTIONS-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16705332#comment-16705332 ] ASF GitHub Bot commented on COLLECTIONS-707: -------------------------------------------- GitHub user nielsbasjes opened a pull request: https://github.com/apache/commons-collections/pull/63 [COLLECTIONS-707] Added PrefixMap - WIP! First version of the PrefixMap implementation. I consider this a work in progress and expect various review comments. I have included two implementations of this interface: - StringPrefixMap where any String can be used as prefix. - ASCIIPrefixMap where only readable ASCII is allowed as the key. This restriction cuts the retrieval time in half and as such may be useful where speed is very important. About the tests: - I have to add more tests regarding special characters in the Prefix. - Right now there are also a few very simple performance tests to verify the lookup speed. It may be needed to remove these before committing. You can merge this pull request into a Git repository by running: $ git pull https://github.com/nielsbasjes/commons-collections COLLECTIONS-707-PrefixMap Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-collections/pull/63.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #63 ---- commit aab3af5b3eba732b12d4a87a093a881d89723a56 Author: Niels Basjes Date: 2018-11-30T21:59:12Z [COLLECTIONS-707] Added PrefixMap ---- > New collection type: PrefixMap > ------------------------------ > > Key: COLLECTIONS-707 > URL: https://issues.apache.org/jira/browse/COLLECTIONS-707 > Project: Commons Collections > Issue Type: Improvement > Reporter: Niels Basjes > Priority: Major > > I was working on a project ( https://github.com/nielsbasjes/yauaa ) where I ran into the situation that I needed a type of collection that was not yet present in either Java or commons-collections. > So I wrote my own implementation and I think this may be a useful addition to commons-collections. > At this point we have > - the Map that allows retrieval of a single value based on an exact key. > - the Trie that allows retrieval of a set of values based where the keys all start with the same prefix. > What I needed a structure where it holds the prefixes and associated values and I want to retrieve the 'best matching prefix' for a given input. > To illustrate what I mean using the original use case: > PrefixMap prefixMap = new ASCIIPrefixMap<>(false); // false == match case insensitive > prefixMap.put("SM-", "Samsung"); > prefixMap.put("Mi-", "Xiaomi"); > prefixMap.getLongestMatch("SM-1234"); // ---> "Samsung" -- This message was sent by Atlassian JIRA (v7.6.3#76005)