public static /*<>*/ boolean addAll(final ByteCollection/*<>*/ collection, Collection<? extends Byte> another) { if (collection == another) throw new IllegalArgumentException(); long maxPossibleSize = collection.sizeAsLong() + Containers.sizeAsLong(another); collection.ensureCapacity(maxPossibleSize); if (another instanceof ByteCollection) { if (another instanceof InternalByteCollectionOps) { return ((InternalByteCollectionOps) another).reverseAddAllTo(collection); } else { class AddAll implements /*f*/ByteConsumer/*<>*/ { boolean collectionChanged = false; @Override public void accept(byte value) { collectionChanged |= collection.add(value); } } AddAll addAll = new AddAll(); ((ByteCollection) another).forEach(addAll); return addAll.collectionChanged; } } else { boolean collectionChanged = false; for (Byte v : another) { collectionChanged |= collection.add(v/* if !(obj elem) */.byteValue()/* endif */); } return collectionChanged; } }
public static /*<>*/ boolean addAll(final ByteCollection/*<>*/ collection, Collection<? extends Byte> another) { if (collection == another) throw new IllegalArgumentException(); long maxPossibleSize = collection.sizeAsLong() + Containers.sizeAsLong(another); collection.ensureCapacity(maxPossibleSize); if (another instanceof ByteCollection) { if (another instanceof InternalByteCollectionOps) { return ((InternalByteCollectionOps) another).reverseAddAllTo(collection); } else { class AddAll implements /*f*/ByteConsumer/*<>*/ { boolean collectionChanged = false; @Override public void accept(byte value) { collectionChanged |= collection.add(value); } } AddAll addAll = new AddAll(); ((ByteCollection) another).forEach(addAll); return addAll.collectionChanged; } } else { boolean collectionChanged = false; for (Byte v : another) { collectionChanged |= collection.add(v/* if !(obj elem) */.byteValue()/* endif */); } return collectionChanged; } }