Package com.gs.collections.impl

Examples of com.gs.collections.impl.Counter


        });
    }

    public void forEachWithIndex(final ObjectIntProcedure<? super E> objectIntProcedure)
    {
        final Counter index = new Counter();
        this.iterables.forEach(new Procedure<Iterable<E>>()
        {
            public void value(Iterable<E> iterable)
            {
                Iterate.forEach(iterable, new Procedure<E>()
                {
                    public void value(E object)
                    {
                        objectIntProcedure.value(object, index.getCount());
                        index.increment();
                    }
                });
            }
        });
    }
View Full Code Here


    }

    @Override
    public int hashCode()
    {
        final Counter result = new Counter();
        this.forEachWithOccurrences(new CharIntProcedure()
        {
            public void value(char eachItem, int occurrences)
            {
                result.add((int) eachItem ^ occurrences);
            }
        });
        return result.getCount();
    }
View Full Code Here

        }
    }

    public int count(final CharPredicate predicate)
    {
        final Counter result = new Counter();
        this.forEachWithOccurrences(new CharIntProcedure()
        {
            public void value(char each, int occurrences)
            {
                if (predicate.accept(each))
                {
                    result.add(occurrences);
                }
            }
        });
        return result.getCount();
    }
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);
            }
        });
        return result.getCount();
    }
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))
                {
                    result.add(occurrences);
                }
            }
        });
        return result.getCount();
    }
View Full Code Here

        return procedure.getCount();
    }

    public <P> int countWith(final Predicate2<? super T, ? super P> predicate, P parameter)
    {
        final Counter count = new Counter();
        this.forEachWith(new Procedure2<T, P>()
        {
            public void value(T each, P parm)
            {
                if (predicate.accept(each, parm))
                {
                    count.increment();
                }
            }
        }, parameter);
        return count.getCount();
    }
View Full Code Here

    }

    @Override
    public int hashCode()
    {
        final Counter result = new Counter();
        this.forEachWithOccurrences(new ByteIntProcedure()
        {
            public void value(byte eachItem, int occurrences)
            {
                result.add((int) eachItem ^ occurrences);
            }
        });
        return result.getCount();
    }
View Full Code Here

        }
    }

    public int count(final BytePredicate predicate)
    {
        final Counter result = new Counter();
        this.forEachWithOccurrences(new ByteIntProcedure()
        {
            public void value(byte each, int occurrences)
            {
                if (predicate.accept(each))
                {
                    result.add(occurrences);
                }
            }
        });
        return result.getCount();
    }
View Full Code Here

        return procedure.getCount();
    }

    public <P> int countWith(final Predicate2<? super K, ? super P> predicate, P parameter)
    {
        final Counter count = new Counter();
        this.forEachWith(new Procedure2<K, P>()
        {
            public void value(K each, P parm)
            {
                if (predicate.accept(each, parm))
                {
                    count.increment();
                }
            }
        }, parameter);
        return count.getCount();
    }
View Full Code Here

    }

    @Override
    public int hashCode()
    {
        final Counter result = new Counter();
        this.forEachWithOccurrences(new ShortIntProcedure()
        {
            public void value(short eachItem, int occurrences)
            {
                result.add((int) eachItem ^ occurrences);
            }
        });
        return result.getCount();
    }
View Full Code Here

TOP

Related Classes of com.gs.collections.impl.Counter

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.