java: copy-on-write data structure?

Posted by Jason S on Stack Overflow See other posts from Stack Overflow or by Jason S
Published on 2010-05-05T16:04:58Z Indexed on 2010/05/05 16:08 UTC
Read the original article Hit count: 232

Filed under:
|

Is there anything in Java that implements something like the following

interface MSet<T> extends Iterable<T> {
    /**
     * return a new set which consists of this set plus a new element.
     * This set is not changed.
     */
    MSet<T> add(T t);

    /**
     * return a new set which consists of this set minus a designated element.
     * This set is not changed.
     */
    MSet<T> remove(T t);
}

© Stack Overflow or respective owner

Related posts about java

Related posts about collections