[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-dev
Subject: [jira] [Commented] (COLLECTIONS-707) New collection type: PrefixMap
From: "ASF GitHub Bot (JIRA)" <jira () apache ! org>
Date: 2018-11-30 23:28:00
Message-ID: JIRA.13201720.1543614525000.68716.1543620480240 () Atlassian ! JIRA
[Download RAW message or body]
[ https://issues.apache.org/jira/browse/COLLECTIONS-707?page=com.atlassian.jira.pl \
ugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16705421#comment-16705421 \
]
ASF GitHub Bot commented on COLLECTIONS-707:
--------------------------------------------
Github user nielsbasjes commented on the issue:
https://github.com/apache/commons-collections/pull/63
Code coverage is now 100% of the new code.
> 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<String> 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)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic