-
Notifications
You must be signed in to change notification settings - Fork 165
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
IterableAsList is very ineffective #157
Comments
@yegor256 how would you change it, if it should still be able to reflect changes in the underlying Iterable? IterableAsMap suffers from the same problem. It initializes itself on the first call, but any change after that, will not be reflected anymore @Test
public void iterableAsMapReflectsUnderlyingChanges() {
Map<String, String> underlyingMap = new HashMap<String, String>();
Map<String, String> map = new IterableAsMap<String, String>
(underlyingMap.entrySet());
map.get("");
underlyingMap.put("TestKey", "TestValue");
MatcherAssert.assertThat("Did not contain Key",
map.get("TestKey"), Matchers.is("TestValue"));
} |
Currently |
@Timmeey yes, this is how it should be -- they must be immutable. |
@yegor256 are you arguing that you should not be able to add/remove elements from lists, but only create new lists? From what i see here, the underlying list is not part of the state of the IterableAsList but rather part of its behaviour. |
fixed in #175 |
The implementation of
IterableAsList
is very wrong, performance wise. Let's implement it similar to whatIterableAsMap
is doing.The text was updated successfully, but these errors were encountered: