Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayProxyList.indexOf doesn't work correctly with 'sliced' proxies #2

Closed
jenetics opened this issue Jan 20, 2015 · 1 comment
Closed
Assignees
Labels
Milestone

Comments

@jenetics
Copy link
Owner

When searching for the index and an element is found, the start index of the used ArrayProxy must be subtracted:

// In org.jenetics.internal.collection.ArrayProxyList class.
for (int i = proxy.start; i < proxy.end && index == -1; ++i) {
    if (element.equals(proxy.__get__(i))) {
        // Subtract the start index of the used proxy: 
        // index = i - proxy.start;
        index = i;
    }
}
@jenetics jenetics added the bug label Jan 20, 2015
@jenetics jenetics self-assigned this Jan 20, 2015
@jenetics jenetics added this to the v3.1.0 milestone Jan 20, 2015
@jenetics
Copy link
Owner Author

Fixed: #3

@jenetics jenetics modified the milestones: v3.0.1, v3.1.0 Mar 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant