commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1177) Improve indexOf performance when called multiple times
Date Sat, 24 Oct 2015 13:30:27 GMT

    [ https://issues.apache.org/jira/browse/LANG-1177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14972597#comment-14972597
] 

Sebb commented on LANG-1177:
----------------------------

However the removeAllOccurrences methods would become trivial:

{code}
    public static long[] removeAllOccurences(final long[] array, final long element) {
        BitSet foundBits = indexesOf(array, element);
        return (long[]) removeAll((Object)array, foundBits);
    }
{code}

> Improve indexOf performance when called multiple times
> ------------------------------------------------------
>
>                 Key: LANG-1177
>                 URL: https://issues.apache.org/jira/browse/LANG-1177
>             Project: Commons Lang
>          Issue Type: Improvement
>            Reporter: Sebb
>
> The indexOf methods search for a single entry in an array.
> This works fine when only the first matching entry is needed, however it is not so efficient
when all matches are needed (because of the setup/teardown overheads).
> It might be useful to introduce an indexesOf method that returns a BitSet containing
all the matches.
> This can then be used in the removeAllOccurrences methods.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message