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

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


        return set;
    }

    public MutableLongBag toBag()
    {
        final MutableLongBag bag = new LongHashBag();
        this.forEach(new LongProcedure()
        {
            public void value(long each)
            {
                bag.add(each);
            }
        });
        return bag;
    }
View Full Code Here


    @Override
    public <R extends MutableLongCollection> R collectLong(final LongFunction<? super T> longFunction, final R target)
    {
        if (target instanceof MutableLongBag)
        {
            final MutableLongBag targetBag = (MutableLongBag) target;
            this.forEachWithOccurrences(new ObjectIntProcedure<T>()
            {
                public void value(T each, int occurrences)
                {
                    targetBag.addOccurrences(longFunction.longValueOf(each), occurrences);
                }
            });
        }
        else
        {
View Full Code Here

        }

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

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

            this.bag = deserializedBag;
        }
View Full Code Here

        return result;
    }

    public MutableLongBag toBag()
    {
        MutableLongBag result = new LongHashBag(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.MutableLongBag

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.