Invoke the specified consumer with the bound value, or do nothing if no value has
been bound.
@param consumer block to execute if a value has been bound
514027
public void ifBound(Consumer<? super T> consumer) {
		Assert.notNull(consumer, "Consumer must not be null");
		if (this.value != null) {
			consumer.accept(this.value);
		}
	}
1222301
public void setConsumers(java.util.Collection<Consumer> consumers) {
        if (consumers == null) {
            this.consumers = null;
            return;
        }

        this.consumers = new com.amazonaws.internal.SdkInternalList<Consumer>(consumers);
    }
40243
void addConsumer(ConsumerSessionImpl consumer) {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "addConsumer", consumer);

        _consumerList.add(consumer);

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "addConsumer");
    }
63825
public <T> void use(final Class<T> type, final Consumer<T> consumer) {
        if (uiThreadRunner.isOnUiThread()) {
            try {
                graph.use(type, Inject.class, consumer);
            } catch (PokeException e) {
                throw new MvcGraphException(e.getMessage(), e);
            }
        } else {
            uiThreadRunner.post(new Runnable() {
                @Override
                public void run() {
                    try {
                        graph.use(type, Inject.class, consumer);
                    } catch (PokeException e) {
                        throw new MvcGraphException(e.getMessage(), e);
                    }
                }
            });
        }
    }
728023
synchronized void add(ConsumerSessionImpl consumer)
  {
    consumer.setId(_consumerCount);
    
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "add", new Long(consumer.getIdInternal()) );

    _consumers.put(new Long(_consumerCount), consumer);

    _consumerCount++;

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "add");
  }
976822
private void setAsyncListener(MessageListener listener) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setAsyncListener", listener);

        consumer = new Consumer(listener, session, sessionAckMode);
        try {
            // ConsumerSession must be stopped to register the callback
            coreConsumerSession.stop();
            int batchSize = 1;
            boolean deliverImmediately = false;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "Registering async callback for consumer" + consumer);
            // the register call will replace any existing callback, so no need for
            // separate deregister call.
            coreConsumerSession.registerAsynchConsumerCallback(consumer,
                                                               0, // maxActiveMessages - no limit
                                                               0, // messageLockExpiry - no expiry
                                                               batchSize,
                                                               session.getOrderingContext()
                            );

            // Deal with the case where the listener is set after the connection
            // is started. Note that this will handle the restarting of the core
            // consumer session if we paused it earlier in this block.
            if (session.getState() == STARTED)
                coreConsumerSession.start(deliverImmediately);
        } catch (SIIncorrectCallException sie) {
            // No FFDC code needed
            // d222942 review. Default message ok.
            // d238447 FFDC Review. FFDC here, see comment in next catch for more detail.
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0085",
                                                            new Object[] { sie, "JmsMsgConsumerImpl.setAsyncListener" },
                                                            sie,
                                                            "JmsMsgConsumerImpl.setAsyncListener#1",
                                                            this,
                                                            tc);
        } catch (SIException sie) {
            // No FFDC code needed
            // The exceptions thrown by stop, registerAsynchConsumerCallback and start are mostly
            // the "connection lost" family. registerAsynchConsumerCallback can also throw an
            // SIIncorrectCallException if the coreConsumerSession hasn't been stopped, but that
            // shouldn't be possible in the code above. Default message ok.
            // d238447 FFDC Review. SIIncorrectCall separated into its own catch block above,
            //   no FFDCs for this group.
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0085",
                                                            new Object[] { sie, "JmsMsgConsumerImpl.setAsyncListener" },
                                                            sie,
                                                            null, // null probeId = no FFDC
                                                            this,
                                                            tc);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setAsyncListener");
    }
767171
public static void loopBlocks(int start , int endExclusive , IntRangeConsumer consumer ) {
		final ForkJoinPool pool = BoofConcurrency.pool;
		int numThreads = pool.getParallelism();

		int range = endExclusive-start;
		if( range == 0 ) // nothing to do here!
			return;
		if( range < 0 )
			throw new IllegalArgumentException("end must be more than start. "+start+" -> "+endExclusive);

		// Did some experimentation here. Gave it more threads than were needed or exactly what was needed
		// exactly seemed to do better in the test cases
		int blockSize = Math.max(1,range/numThreads);

		try {
			pool.submit(new IntRangeTask(start,endExclusive,blockSize,consumer)).get();
		} catch (InterruptedException | ExecutionException e) {
			throw new RuntimeException(e);
		}
	}
95303
public void forEach(final IntObjConsumer<String> consumer)
    {
        int counterId = 0;

        final AtomicBuffer metaDataBuffer = this.metaDataBuffer;
        for (int i = 0, capacity = metaDataBuffer.capacity(); i < capacity; i += METADATA_LENGTH)
        {
            final int recordStatus = metaDataBuffer.getIntVolatile(i);

            if (RECORD_ALLOCATED == recordStatus)
            {
                consumer.accept(counterId, labelValue(metaDataBuffer, i));
            }
            else if (RECORD_UNUSED == recordStatus)
            {
                break;
            }

            counterId++;
        }
    }
469204
protected void invokeConsumer(Consumer<ProgressUpdate> consumer, ProgressUpdate progressUpdate) {
		try {
			consumer.accept(progressUpdate);
		} catch (Throwable t) {
			logger.error("Exception thrown by a Consumer<ProgressUpdate> consumer: " + consumer + "; progressUpdate: " + progressUpdate, t);
		}
	}
1182814
public static <T> Function<T, Void> voidFunction(Consumer<T> consumer) {
        return v -> {
            consumer.accept(v);
            return null;
        };
    }
884010
def _declare_consumer(self, consumer, nowait=False):
        """"""
        if consumer.queue not in self._open_consumers:
            # Use the ConsumerSet's consumer by default, but if the
            # child consumer has a callback, honor it.
            callback = consumer.callbacks and \
                consumer._receive_callback or self._receive_callback
            self.backend.declare_consumer(queue=consumer.queue,
                                          no_ack=consumer.no_ack,
                                          nowait=nowait,
                                          callback=callback,
                                          consumer_tag=consumer.consumer_tag)
            self._open_consumers[consumer.queue] = consumer.consumer_tag
782263
private void notifyConsumer( AbstractMessage message )
    {
    	consumersLock.readLock().lock();
    	try
    	{
    		switch (localConsumers.size())
    		{
    			case 0 : return; // Nobody's listening
    			case 1 : 
    				notifySingleConsumer(localConsumers.get(0),message);
    				break;
    			default : // Multiple consumers
    				notifyNextConsumer(localConsumers,message);
    				break;
    		}
    	}
    	finally
    	{
    		consumersLock.readLock().unlock();
    	}
    }
934558
public static <T> void forEach(final Iterable<T> iterable, final Consumer<? super T> consumer) {
        checkNotNull(iterable, "forEach must have a valid iterable");
        checkNotNull(consumer, "forEach must have a valid consumer");

        for (T t : iterable) {
            consumer.accept(t);
        }
    }
158621
public void getView(final Consumer<Parent> consumer) {
		CompletableFuture.supplyAsync(this::getView, Platform::runLater).thenAccept(consumer);
	}
775888
public static <T, C extends Collection<T>> void
    ifNotNullOrEmptyConsume(C collection, Consumer<C> consumer) {
        JMOptional.getOptional(collection).ifPresent(consumer);
    }
100002
public void forEach(IntConsumer consumer)
    {
        for (int ii=0;ii<array.length;ii++)
        {
            if (array[ii] != 0)
            {
                int lim = Math.min(bits, (ii+1)*8);
                for (int jj=ii*8;jj<lim;jj++)
                {
                    if (isSet(jj))
                    {
                        consumer.accept(jj);
                    }
                }
            }
        }
    }
672422
synchronized void remove(ConsumerSessionImpl consumer)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "remove", consumer );
      
    _consumers.remove(new Long(consumer.getIdInternal()));
    
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "remove");    
  }