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

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

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

import java.util.Arrays;


/**
 * @author arno
 */
public class ALongHashSet extends MapAsSetWrapper {
    private static final ALongHashSet EMPTY = new ALongHashSet (ALongHashMap.empty ());

    public static ALongHashSet empty () {
        return EMPTY;
    }

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

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

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

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

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

    public static ALongHashSet create (ALongHashMap inner) {
        return new ALongHashSet (inner);
    }


    public ALongHashSet (AMap inner) {
        super (inner);
    }

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


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy