Package com.gs.collections.api.bag.primitive

Examples of com.gs.collections.api.bag.primitive.MutableIntBag


        return set;
    }

    public MutableIntBag toBag()
    {
        final MutableIntBag bag = new IntHashBag();
        this.forEach(new IntProcedure()
        {
            public void value(int each)
            {
                bag.add(each);
            }
        });
        return bag;
    }
View Full Code Here


    @Override
    public <R extends MutableIntCollection> R collectInt(final IntFunction<? super T> intFunction, final R target)
    {
        if (target instanceof MutableIntBag)
        {
            final MutableIntBag targetBag = (MutableIntBag) target;
            this.forEachWithOccurrences(new ObjectIntProcedure<T>()
            {
                public void value(T each, int occurrences)
                {
                    targetBag.addOccurrences(intFunction.intValueOf(each), occurrences);
                }
            });
        }
        else
        {
View Full Code Here

        }

        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
        {
            int size = in.readInt();
            MutableIntBag deserializedBag = new IntHashBag();

            for (int i = 0; i < size; i++)
            {
                deserializedBag.addOccurrences(in.readInt(), in.readInt());
            }

            this.bag = deserializedBag;
        }
View Full Code Here

        return result;
    }

    public MutableIntBag toBag()
    {
        MutableIntBag result = new IntHashBag(this.size());

        for (int i = 0; i < this.keys.length; i++)
        {
            if (isNonSentinel(this.keys[i]))
            {
                result.add(this.values[i]);
            }
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of com.gs.collections.api.bag.primitive.MutableIntBag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.