Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[epsilon-dev] EOL collection inheritance redesign

Hi everyone,


Following the discussion on concurrent collections, I thought perhaps a better design in allowing for more flexibility of underlying EOL collection types was needed. My proposal is as follows:


All EOL collection types extend EolBag, which already implements Collection and delegates to a wrapped Collection. Extensions, such as EolSet, only need to change the wrapped type. Everything else can be handled automatically by the wrapped implementation. Of course, the equals method needs rethinking. Here is what I have in EolBag, which seems to be working (all tests passing):



public boolean equals(Object obj) {

    if (this == obj) return true;

    if (!(obj instanceof Collection)) return false;

    return obj instanceof EolBag ?

        Objects.equals(this.wrapped, ((EolBag<?>) obj).wrapped) :





public int hashCode() {

    return wrapped.hashCode();




public String toString() {

    return getClass().getSimpleName()+" "+wrapped.toString();



Does this seem reasonable?




Back to the top