Mutable collections #161

Merged
1 commit merged into from Feb 25, 2011

2 participants

@alexism

(from https://groups.google.com/d/topic/hector-dev/KDh3jSVhaAU/discussion)

All tests pass.

(...)
I noticed that this not always possible with Hector. For instance OrderedSuperRows.getList returns an unmodifiable list, so does HSuperColumnImpl#getColumns.

I don't see why the user will be forbidden to alter the returned collections.
I found only 5 (not 4) valid occurences, so the change seems small.

    HSuperColumnImpl.java  
        (112: 23) return Collections.unmodifiableList(columns);
    OrderedRowsImpl.java  
        (40: 23) return Collections.unmodifiableList(new ArrayList<Row<K, N, V>>(rowsList));
    OrderedSuperRowsImpl.java  
        (38: 23) return Collections.unmodifiableList(rowsList);
    SuperSliceImpl.java  
        (47: 23) return Collections.unmodifiableList(columnsList);
    ColumnSliceImpl

Would you guys agree to drop this constraint?

ps: as of today the immutability constraint is not always applied. For instance SuperRowsImpl#iterator is mutable.

@zznate
Collaborator

The diff did not pick up an Iterator import and your formatting was ghetto (2 space tabs), but otherwise +1 (I fixed it real quick already).

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment