Package gnu.trove.iterator

Examples of gnu.trove.iterator.TIntIterator


            return true;
        }

        /** {@inheritDoc} */
        public boolean containsAll( TIntCollection collection ) {
            TIntIterator iter = collection.iterator();
            while ( iter.hasNext() ) {
                if ( ! TObjectIntCustomHashMap.this.containsValue( iter.next() ) ) {
                    return false;
                }
            }
            return true;
        }
View Full Code Here


        /** {@inheritDoc} */
        @SuppressWarnings({"SuspiciousMethodCalls"})
        public boolean retainAll( Collection<?> collection ) {
            boolean modified = false;
            TIntIterator iter = iterator();
            while ( iter.hasNext() ) {
                if ( ! collection.contains( Integer.valueOf ( iter.next() ) ) ) {
                    iter.remove();
                    modified = true;
                }
            }
            return modified;
        }
View Full Code Here

        public boolean retainAll( TIntCollection collection ) {
            if ( this == collection ) {
                return false;
            }
            boolean modified = false;
            TIntIterator iter = iterator();
            while ( iter.hasNext() ) {
                if ( ! collection.contains( iter.next() ) ) {
                    iter.remove();
                    modified = true;
                }
            }
            return modified;
        }
View Full Code Here

            if ( this == collection ) {
                clear();
                return true;
            }
            boolean changed = false;
            TIntIterator iter = collection.iterator();
            while ( iter.hasNext() ) {
                int element = iter.next();
                if ( remove( element ) ) {
                    changed = true;
                }
            }
            return changed;
View Full Code Here

        }
        assertFalse( keyset.isEmpty() );

        int[] keys_array = keyset.toArray();
        int count = 0;
        TIntIterator iter = keyset.iterator();
        while ( iter.hasNext() ) {
            int key = iter.next();
            assertTrue( keyset.contains( key ) );
            assertEquals( keys_array[count], key );
            count++;
        }

        //noinspection ToArrayCallWithZeroLengthArrayArgument
        keys_array = keyset.toArray( new int[0] );
        count = 0;
        iter = keyset.iterator();
        while ( iter.hasNext() ) {
            int key = iter.next();
            assertTrue( keyset.contains( key ) );
            assertEquals( keys_array[count], key );
            count++;
        }

        keys_array = keyset.toArray( new int[keyset.size()] );
        count = 0;
        iter = keyset.iterator();
        while ( iter.hasNext() ) {
            int key = iter.next();
            assertTrue( keyset.contains( key ) );
            assertEquals( keys_array[count], key );
            count++;
        }

        keys_array = keyset.toArray( new int[keyset.size() * 2] );
        count = 0;
        iter = keyset.iterator();
        while ( iter.hasNext() ) {
            int key = iter.next();
            assertTrue( keyset.contains( key ) );
            assertEquals( keys_array[count], key );
            count++;
        }
        assertEquals( keyset.getNoEntryValue(), keys_array[keyset.size()] );
View Full Code Here

        int[] ints = {42, 1138, 13, 86, 99};
        set.addAll(ints);
        int[] toarray_ints = set.toArray();

        int[] iter_ints = new int[5];
        TIntIterator iter = set.iterator();

        int index = 0;
        while (iter.hasNext()) {
            iter_ints[index++] = iter.next();
        }

        assertTrue(Arrays.equals(iter_ints, toarray_ints));
    }
View Full Code Here

        set.add(1);
        set.add(2);
        set.add(3);
        set.add(4);

        TIntIterator iter = set.iterator();
        assertTrue("iterator should have a next item", iter.hasNext());

        int last = -1;
        while (iter.hasNext()) {
            int next = iter.next();
            assertTrue(Integer.valueOf(next).toString(),
                    next >= 1 && next <= 4);
            assertTrue(Integer.valueOf(next).toString(), next != last);
            last = next;
        }

        assertFalse("iterator should not have a next item", iter.hasNext());

        assertTrue("set should contain 1", set.contains(1));
        assertTrue("set should contain 2", set.contains(2));
        assertTrue("set should contain 3", set.contains(3));
        assertTrue("set should contain 4", set.contains(4));
View Full Code Here

        set.add(1);
        set.add(2);
        set.add(3);
        set.add(4);

        TIntIterator iter = set.iterator();
        assertTrue("iterator should have a next item", iter.hasNext());

        int last = -1;
        while (iter.hasNext()) {
            int next = iter.next();
            assertTrue(next >= 1 && next <= 4);
            assertTrue(next != last);
            last = next;

            if (next == 3) {
                iter.remove();
            }
        }

        assertFalse("iterator should not have a next item", iter.hasNext());

        assertFalse("set should not contain 3", set.contains(3));
        assertTrue("set should contain 1", set.contains(1));
        assertTrue("set should contain 2", set.contains(2));
        assertTrue("set should contain 4", set.contains(4));
View Full Code Here

        this.from = ApplyIndexMapping.optimizeDummies(from);
        this.to = ApplyIndexMapping.optimizeDummies(to);

        int[] typesCounts = new int[IndexType.TYPES_COUNT];

        TIntIterator iterator = TensorUtils.getAllDummyIndicesIncludingScalarFunctionsT(to).iterator();
        while (iterator.hasNext())
            ++typesCounts[IndicesUtils.getType(iterator.next())];

        iterator = TensorUtils.getAllDummyIndicesT(from).iterator();
        while (iterator.hasNext())
            --typesCounts[IndicesUtils.getType(iterator.next())];

        boolean possiblyAddsDummies = false;
        for (int i : typesCounts)
            if (i > 0) {
                possiblyAddsDummies = true;
View Full Code Here

                usedArrays[i] = new BitArray(size);

            //Fulfilling origins array
            for (i = size - 1; i >= 0; --i) {
                dummy = TensorUtils.getAllDummyIndicesT(tensor.get(i));
                TIntIterator iterator = dummy.iterator();

                while (iterator.hasNext())
                    usedArrays[Arrays.binarySearch(allDummyIndices, iterator.next())].set(i);
            }
        }
View Full Code Here

TOP

Related Classes of gnu.trove.iterator.TIntIterator

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.