All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ajjpj.afoundation.collection.immutable.ALongRedBlackTreeSet Maven / Gradle / Ivy

The newest version!
package com.ajjpj.afoundation.collection.immutable;

import java.util.Arrays;


/**
 * @author arno
 */
public class ALongRedBlackTreeSet extends MapAsSetWrapper {
    public static ALongRedBlackTreeSet empty () {
        return new ALongRedBlackTreeSet (ALongRedBlackTreeMap. empty ());
    }

    public static ALongRedBlackTreeSet create (long... elements) {
        ALongRedBlackTreeSet result = empty ();

        for (long el: elements) {
            result = result.added (el); //TODO specialize this
        }
        return result;
    }

    public static ALongRedBlackTreeSet create (Long... elements) {
        return create (Arrays.asList (elements));
    }

    public static ALongRedBlackTreeSet create (Iterable elements) {
        ALongRedBlackTreeSet result = empty ();

        for (Long el: elements) {
            result = result.added (el);
        }
        return result;
    }

    public static ALongRedBlackTreeSet create (ALongRedBlackTreeMap inner) {
        return new ALongRedBlackTreeSet (inner);
    }

    private ALongRedBlackTreeSet (AMap inner) {
        super (inner);
    }

    @Override protected ALongRedBlackTreeSet wrapAsSet (AMap inner) {
        return new ALongRedBlackTreeSet (inner);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy