Package gnu.trove.iterator

Examples of gnu.trove.iterator.TLongIterator


     * even if the iterator returns a different number of elements.
     */
    @Override
    public long[] toArray() {
        long[] dest = new long[size()];
        final TLongIterator it = iterator();
        for (int i = 0; i < dest.length; i++) {
            if (!it.hasNext()) // fewer elements than expected
                return Arrays.copyOf(dest, i);
            dest[i] = it.next();
        }
        return it.hasNext() ? finishToArray(dest, it) : dest;
    }
View Full Code Here


     * <p>This implementation uses the iterator to fill the array according
     * to spec.
     */
    @Override
    public long[] toArray(long[] dest) {
        final TLongIterator it = iterator();
        for (int i = 0; i < dest.length; i++) {
            if (!it.hasNext()) {// fewer elements than expected
                dest[i] = getNoEntryValue();
                break;
            }
            dest[i] = it.next();
        }
        return dest;
    }
View Full Code Here

     *
     * @return a string representation of this collection
     */
    @Override
    public String toString() {
        final TLongIterator it = iterator();
        if (!it.hasNext())
            return "[]";

        StringBuilder sb = new StringBuilder();
        sb.append('[');
        for (;;) {
            long e = it.next();
            sb.append(e);
            if (!it.hasNext())
                return sb.append(']').toString();
            sb.append(',').append(' ');
        }
    }
View Full Code Here

    @Override
    public synchronized Iterator<Long> iterator() {
        if (lines == null)
            return Collections.emptyIterator();
        final TLongIterator it = lines.iterator();
        return new Iterator<Long>() {
            @Override
            public boolean hasNext() {
                return it.hasNext();
            }

            @Override
            public Long next() {
                return it.next();
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
View Full Code Here

        return length;
    }

    @Override
    public TLongIterator iterator() {
        return new TLongIterator() {
            private int nextIndex = 0;

            @Override
            public boolean hasNext() {
                return nextIndex < length;
View Full Code Here

     * even if the iterator returns a different number of elements.
     */
    @Override
    public long[] toArray() {
        long[] dest = new long[size()];
        final TLongIterator it = iterator();
        for (int i = 0; i < dest.length; i++) {
            if (!it.hasNext()) // fewer elements than expected
                return Arrays.copyOf(dest, i);
            dest[i] = it.next();
        }
        return it.hasNext() ? finishToArray(dest, it) : dest;
    }
View Full Code Here

     * <p>This implementation uses the iterator to fill the array according
     * to spec.
     */
    @Override
    public long[] toArray(long[] dest) {
        final TLongIterator it = iterator();
        for (int i = 0; i < dest.length; i++) {
            if (!it.hasNext()) {// fewer elements than expected
                dest[i] = getNoEntryValue();
                break;
            }
            dest[i] = it.next();
        }
        return dest;
    }
View Full Code Here

     *
     * @return a string representation of this collection
     */
    @Override
    public String toString() {
        final TLongIterator it = iterator();
        if (!it.hasNext())
            return "[]";

        StringBuilder sb = new StringBuilder();
        sb.append('[');
        for (;;) {
            long e = it.next();
            sb.append(e);
            if (!it.hasNext())
                return sb.append(']').toString();
            sb.append(',').append(' ');
        }
    }
View Full Code Here

        return true;
    }

    @Override
    public TLongIterator iterator() {
        return new TLongIterator() {
            private Iterator<TLongCollection> ce = collections.iterator();
            private TLongIterator i = null;

            @Override
            public boolean hasNext() {
View Full Code Here

TOP

Related Classes of gnu.trove.iterator.TLongIterator

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.