Package com.gs.collections.api.block.procedure.primitive

Examples of com.gs.collections.api.block.procedure.primitive.LongIntProcedure


    }

    public LongHashBag(LongHashBag bag)
    {
        this.items = new LongIntHashMap(bag.sizeDistinct());
        bag.forEachWithOccurrences(new LongIntProcedure()
        {
            public void value(long item, int occurrences)
            {
                LongHashBag.this.addOccurrences(item, occurrences);
            }
View Full Code Here


    }

    public static LongHashBag newBag(LongBag source)
    {
        final LongHashBag result = new LongHashBag();
        source.forEachWithOccurrences(new LongIntProcedure()
        {
            public void value(long each, int occurrences)
            {
                result.addOccurrences(each, occurrences);
            }
View Full Code Here

            return false;
        }
        if (source instanceof LongBag)
        {
            LongBag otherBag = (LongBag) source;
            otherBag.forEachWithOccurrences(new LongIntProcedure()
            {
                public void value(long each, int occurrences)
                {
                    LongHashBag.this.addOccurrences(each, occurrences);
                }
View Full Code Here

        }
        int oldSize = this.size();
        if (source instanceof LongBag)
        {
            LongBag otherBag = (LongBag) source;
            otherBag.forEachWithOccurrences(new LongIntProcedure()
            {
                public void value(long each, int occurrences)
                {
                    int oldOccurrences = LongHashBag.this.items.removeKeyIfAbsent(each, 0);
                    LongHashBag.this.size -= oldOccurrences;
View Full Code Here

        return true;
    }

    public void forEach(final LongProcedure procedure)
    {
        this.items.forEachKeyValue(new LongIntProcedure()
        {
            public void value(long key, int occurrences)
            {
                for (int i = 0; i < occurrences; i++)
                {
View Full Code Here

    }

    public LongHashBag select(final LongPredicate predicate)
    {
        final LongHashBag result = new LongHashBag();
        this.forEachWithOccurrences(new LongIntProcedure()
        {
            public void value(long each, int occurrences)
            {
                if (predicate.accept(each))
                {
View Full Code Here

    }

    public LongHashBag reject(final LongPredicate predicate)
    {
        final LongHashBag result = new LongHashBag();
        this.forEachWithOccurrences(new LongIntProcedure()
        {
            public void value(long each, int occurrences)
            {
                if (!predicate.accept(each))
                {
View Full Code Here

    @Override
    public int hashCode()
    {
        final Counter result = new Counter();
        this.forEachWithOccurrences(new LongIntProcedure()
        {
            public void value(long eachItem, int occurrences)
            {
                result.add((int) (eachItem ^ eachItem >>> 32) ^ occurrences);
            }
View Full Code Here

    {
        final boolean[] firstItem = {true};
        try
        {
            appendable.append(start);
            this.items.forEachKeyValue(new LongIntProcedure()
            {
                public void value(long each, int occurrences)
                {
                    try
                    {
View Full Code Here

    }

    public int count(final LongPredicate predicate)
    {
        final Counter result = new Counter();
        this.forEachWithOccurrences(new LongIntProcedure()
        {
            public void value(long each, int occurrences)
            {
                if (predicate.accept(each))
                {
View Full Code Here

TOP

Related Classes of com.gs.collections.api.block.procedure.primitive.LongIntProcedure

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.