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

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


        return set;
    }

    public MutableDoubleBag toBag()
    {
        final MutableDoubleBag bag = new DoubleHashBag();
        this.forEach(new DoubleProcedure()
        {
            public void value(double each)
            {
                bag.add(each);
            }
        });
        return bag;
    }
View Full Code Here


        }

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

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

            this.bag = deserializedBag;
        }
View Full Code Here

    @Override
    public <R extends MutableDoubleCollection> R collectDouble(final DoubleFunction<? super T> doubleFunction, final R target)
    {
        if (target instanceof MutableDoubleBag)
        {
            final MutableDoubleBag targetBag = (MutableDoubleBag) target;
            this.forEachWithOccurrences(new ObjectIntProcedure<T>()
            {
                public void value(T each, int occurrences)
                {
                    targetBag.addOccurrences(doubleFunction.doubleValueOf(each), occurrences);
                }
            });
        }
        else
        {
View Full Code Here

        return result;
    }

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

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.