Examples of ByteCollection


Examples of net.openhft.koloboke.collect.ByteCollection

    public static boolean containsAll(final ByteCollection/*<?>*/ collection,
            Collection<?> another) {
        if (collection == another)
            return true;
        if (another instanceof ByteCollection) {
            ByteCollection c2 = (ByteCollection) another;
            /* if obj elem */
            if (collection.equivalence().equals(c2.equivalence())) {
            /* endif */
            if (collection instanceof ByteSet && c2 instanceof ByteSet &&
                    collection.size() < another.size()) {
                return false;
            }
            if (c2 instanceof InternalByteCollectionOps) {
                // noinspection unchecked
                return ((InternalByteCollectionOps) c2).allContainingIn(collection);
            }
            /* if obj elem */
            }
            // noinspection unchecked
            /* endif */
            return c2.forEachWhile(new
                    /*f*/BytePredicate/**/() {
                @Override
                public boolean test(/* raw */byte value) {
                    return collection.contains(value);
                }
View Full Code Here

Examples of org.apache.commons.collections.primitives.ByteCollection

    // tests
    // ------------------------------------------------------------------------
   
    public void testCollectionCallsAreProxied() {
        final InvocationCounter proxied = new InvocationCounter();
        ByteCollection collection = new BaseProxyByteCollection() {
            protected ByteCollection getProxiedCollection() {
                return proxied;
            }
        };
       
        assertEquals(0,proxied.getAddCount());
        collection.add((byte)1);
        assertEquals(1,proxied.getAddCount());

        assertEquals(0,proxied.getAddAllCount());
        collection.addAll(null);
        assertEquals(1,proxied.getAddAllCount());
       
        assertEquals(0,proxied.getClearCount());
        collection.clear();
        assertEquals(1,proxied.getClearCount());

        assertEquals(0,proxied.getContainsCount());
        collection.contains((byte)1);
        assertEquals(1,proxied.getContainsCount());

        assertEquals(0,proxied.getContainsAllCount());
        collection.containsAll(null);
        assertEquals(1,proxied.getContainsAllCount());

        assertEquals(0,proxied.getIsEmptyCount());
        collection.isEmpty();
        assertEquals(1,proxied.getIsEmptyCount());

        assertEquals(0,proxied.getIteratorCount());
        collection.iterator();
        assertEquals(1,proxied.getIteratorCount());

        assertEquals(0,proxied.getRemoveAllCount());
        collection.removeAll(null);
        assertEquals(1,proxied.getRemoveAllCount());

        assertEquals(0,proxied.getRetainAllCount());
        collection.retainAll(null);
        assertEquals(1,proxied.getRetainAllCount());

        assertEquals(0,proxied.getRemoveElementCount());
        collection.removeElement((byte)1);
        assertEquals(1,proxied.getRemoveElementCount());

        assertEquals(0,proxied.getSizeCount());
        collection.size();
        assertEquals(1,proxied.getSizeCount());

        assertEquals(0,proxied.getToArrayByteArrayCount());
        collection.toArray(new byte[0]);
        assertEquals(1,proxied.getToArrayByteArrayCount());
       
        assertEquals(0,proxied.getToArrayCount());
        collection.toArray();
        assertEquals(1,proxied.getToArrayCount());
       
        assertEquals(0,proxied.getToStringCount());
        collection.toString();
        assertEquals(1,proxied.getToStringCount());
       
        assertEquals(0,proxied.getEqualsCount());
        collection.equals(null);
        assertEquals(1,proxied.getEqualsCount());
       
        assertEquals(0,proxied.getHashCodeCount());
        collection.hashCode();
        assertEquals(1,proxied.getHashCodeCount());
       
    }
View Full Code Here

Examples of org.apache.commons.collections.primitives.ByteCollection

    public void testWrapNull() {
        assertNull(CollectionByteCollection.wrap(null));
    }
   
    public void testWrapSerializable() {
        ByteCollection collection = CollectionByteCollection.wrap(new ArrayList());
        assertNotNull(collection);
        assertTrue(collection instanceof Serializable);
    }
View Full Code Here

Examples of org.apache.commons.collections.primitives.ByteCollection

        assertNotNull(collection);
        assertTrue(collection instanceof Serializable);
    }
   
    public void testWrapNonSerializable() {
        ByteCollection collection = CollectionByteCollection.wrap(new AbstractList() {
            public Object get(int i) { throw new IndexOutOfBoundsException(); }
            public int size() { return 0; }
        });
        assertNotNull(collection);
        assertTrue(!(collection instanceof Serializable));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.