Class SynchronizedByteIterable

  • All Implemented Interfaces:
    java.io.Serializable, ByteIterable, PrimitiveIterable

    public class SynchronizedByteIterable
    extends java.lang.Object
    implements ByteIterable, java.io.Serializable
    A synchronized view of a ByteIterable. This file was automatically generated from template file synchronizedPrimitiveIterable.stg.
    Since:
    5.0.
    See Also:
    Serialized Form
    • Field Detail

      • lock

        private final java.lang.Object lock
    • Constructor Detail

      • SynchronizedByteIterable

        protected SynchronizedByteIterable​(ByteIterable iterable)
      • SynchronizedByteIterable

        protected SynchronizedByteIterable​(ByteIterable iterable,
                                           java.lang.Object newLock)
    • Method Detail

      • of

        public static SynchronizedByteIterable of​(ByteIterable iterable,
                                                  java.lang.Object lock)
        This method will take a ByteIterable and wrap it directly in a SynchronizedByteIterable. Additionally, a developer specifies which lock to use with the collection.
      • toArray

        public byte[] toArray()
        Description copied from interface: ByteIterable
        Converts the ByteIterable to a primitive byte array.
        Specified by:
        toArray in interface ByteIterable
      • toArray

        public byte[] toArray​(byte[] target)
        Description copied from interface: ByteIterable
        Converts the ByteIterable to a primitive byte array. If the collection fits into the provided array it is used to store its elements and is returned from the method, otherwise a new array of the appropriate size is allocated and returned. If the iterable is empty, the target array is returned unchanged.
        Specified by:
        toArray in interface ByteIterable
      • contains

        public boolean contains​(byte value)
        Description copied from interface: ByteIterable
        Returns true if the value is contained in the ByteIterable, and false if it is not.
        Specified by:
        contains in interface ByteIterable
      • containsAll

        public boolean containsAll​(byte... source)
        Description copied from interface: ByteIterable
        Returns true if all of the values specified in the source array are contained in the ByteIterable, and false if they are not.
        Specified by:
        containsAll in interface ByteIterable
      • containsAll

        public boolean containsAll​(ByteIterable source)
        Description copied from interface: ByteIterable
        Returns true if all of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are not.
        Specified by:
        containsAll in interface ByteIterable
      • containsAny

        public boolean containsAny​(byte... source)
        Description copied from interface: ByteIterable
        Returns true if any of the values specified in the source array are contained in the ByteIterable, and false if they are not.
        Specified by:
        containsAny in interface ByteIterable
      • containsAny

        public boolean containsAny​(ByteIterable source)
        Description copied from interface: ByteIterable
        Returns true if any of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are not.
        Specified by:
        containsAny in interface ByteIterable
      • containsNone

        public boolean containsNone​(byte... source)
        Description copied from interface: ByteIterable
        Returns true if none of the values specified in the source array are contained in the ByteIterable, and false if they are.
        Specified by:
        containsNone in interface ByteIterable
      • containsNone

        public boolean containsNone​(ByteIterable source)
        Description copied from interface: ByteIterable
        Returns true if none of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are.
        Specified by:
        containsNone in interface ByteIterable
      • select

        public ByteIterable select​(BytePredicate predicate)
        Description copied from interface: ByteIterable
        Returns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.
        Specified by:
        select in interface ByteIterable
      • reject

        public ByteIterable reject​(BytePredicate predicate)
        Description copied from interface: ByteIterable
        Returns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.
        Specified by:
        reject in interface ByteIterable
      • collect

        public <V> RichIterable<V> collect​(ByteToObjectFunction<? extends V> function)
        Description copied from interface: ByteIterable
        Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.
        Specified by:
        collect in interface ByteIterable
      • count

        public int count​(BytePredicate predicate)
        Description copied from interface: ByteIterable
        Returns a count of the number of elements in the ByteIterable that return true for the specified predicate.
        Specified by:
        count in interface ByteIterable
      • anySatisfy

        public boolean anySatisfy​(BytePredicate predicate)
        Description copied from interface: ByteIterable
        Returns true if any of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.
        Specified by:
        anySatisfy in interface ByteIterable
      • allSatisfy

        public boolean allSatisfy​(BytePredicate predicate)
        Description copied from interface: ByteIterable
        Returns true if all of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.
        Specified by:
        allSatisfy in interface ByteIterable
      • noneSatisfy

        public boolean noneSatisfy​(BytePredicate predicate)
        Description copied from interface: ByteIterable
        Returns true if none of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.
        Specified by:
        noneSatisfy in interface ByteIterable
      • maxIfEmpty

        public byte maxIfEmpty​(byte defaultValue)
        Specified by:
        maxIfEmpty in interface ByteIterable
      • minIfEmpty

        public byte minIfEmpty​(byte defaultValue)
        Specified by:
        minIfEmpty in interface ByteIterable
      • chunk

        public RichIterable<ByteIterable> chunk​(int size)
        Description copied from interface: ByteIterable
        Partitions elements in fixed size chunks.
        Specified by:
        chunk in interface ByteIterable
        Parameters:
        size - the number of elements per chunk
        Returns:
        A RichIterable containing ByteIterables of size size, except the last will be truncated if the elements don't divide evenly.
      • toString

        public java.lang.String toString()
        Description copied from interface: PrimitiveIterable
        Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.
         Assert.assertEquals("[]", IntLists.mutable.empty().toString());
         Assert.assertEquals("[1]", IntLists.mutable.with(1).toString());
         Assert.assertEquals("[1, 2, 3]", IntLists.mutable.with(1, 2, 3).toString());
         
        Specified by:
        toString in interface PrimitiveIterable
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this PrimitiveIterable
        See Also:
        AbstractCollection.toString()
      • makeString

        public java.lang.String makeString()
        Description copied from interface: PrimitiveIterable
        Returns a string representation of this collection by delegating to PrimitiveIterable.makeString(String) and defaulting the separator parameter to the characters ", " (comma and space).
        Specified by:
        makeString in interface PrimitiveIterable
        Returns:
        a string representation of this collection.
      • makeString

        public java.lang.String makeString​(java.lang.String start,
                                           java.lang.String separator,
                                           java.lang.String end)
        Description copied from interface: PrimitiveIterable
        Returns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.
        Specified by:
        makeString in interface PrimitiveIterable
        Returns:
        a string representation of this collection.