Refine search
@Override public void forEach(BiConsumer<? super K, ? super V> action) { checkNotNull(action); for (BiEntry<K, V> entry = firstInKeyInsertionOrder; entry != null; entry = entry.nextInKeyInsertionOrder) { action.accept(entry.key, entry.value); } }
@Override public void forEach(BiConsumer<? super Double, ? super Double> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { action.accept(Double.longBitsToDouble(key), Double.longBitsToDouble(tab[i + 1])); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
/** * Creates a callback that will attempt to initialize once. If initialize throws, onInitFailureCleanup is called * before wrapping and throwing a RuntimeException. * @param initialize initialization method. * @param onInitFailureCleanup cleanup to be done in case initialization throws. If this method also throws, it will * propagate up to the caller. * @return the desired Callback object. */ public static <R> Callback<R> singleAttempt(Consumer<R> initialize, BiConsumer<R, Throwable> onInitFailureCleanup) { return new LambdaCallback<>(initialize, onInitFailureCleanup.andThen(FAIL)); }
@Override public void forEach(BiConsumer<? super Double, ? super Double> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { action.accept(Double.longBitsToDouble(key), Double.longBitsToDouble(tab[i + 1])); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public void load(Collection<? extends PdfDocumentDescriptor> toLoad, RequiredPdfData... requires) { LOG.debug(DefaultI18nContext.getInstance().i18n("Loading pdf documents")); BiConsumer<PDDocument, PdfDocumentDescriptor> consumer = Arrays.stream(requires).map(consumers::get) .reduce(STARTER, (r, d) -> r.andThen(d)).andThen(FINISHER); for (PdfDocumentDescriptor current : toLoad) { if (current.hasReferences()) { LOG.trace("Loading {}", current.getFileName()); fxMoveStatusTo(current, LOADING); try (PDDocument document = PDFParser.parse( new BufferedSeekableSource(new FileChannelSeekableSource(current.getFile())), current.getPassword())) { consumer.accept(document, current); } catch (InvalidPasswordException twpe) { fxMoveStatusTo(current, ENCRYPTED); LOG.warn("User password required for '{}'", current.getFileName(), twpe); } catch (Exception e) { LOG.error("An error occured loading the document '{}'", current.getFileName(), e); fxMoveStatusTo(current, WITH_ERRORS); } LOG.info("{} loaded", current.getFileName()); } else { LOG.trace("Skipping invalidated document {}", current.getFileName()); } } LOG.debug(DefaultI18nContext.getInstance().i18n("Documents loaded")); }
private <T, S> BiConsumer<T, S> chainConsumers(final BiConsumer<T, S> currentConsumer, final BiConsumer<T, S> consumer) { if (currentConsumer != null) { return currentConsumer.andThen(consumer); } return consumer; }
@Override public void forEach(BiConsumer<? super Double, ? super Double> action) { if (action == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { action.accept(Double.longBitsToDouble(key), Double.longBitsToDouble(tab[i + 1])); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
void process(@NotNull final WireIn inWire, @NotNull final RequestContext requestContext, @NotNull Asset contextAsset, @NotNull final WireOutPublisher publisher, final long tid, @NotNull final Wire outWire) { setOutWire(outWire); this.outWire = outWire; this.publisher = publisher; this.contextAsset = contextAsset; this.requestContext = requestContext; dataConsumer.accept(inWire, tid); }
@Override public void forEach(BiConsumer<? super K, ? super V> action) { checkNotNull(action); for (int i = 0; i < size; i++) { action.accept((K) keys[i], (V) values[i]); } }
private <T, S> BiConsumer<T, S> chainConsumers(final BiConsumer<T, S> currentConsumer, final BiConsumer<T, S> consumer) { if (currentConsumer != null) { return currentConsumer.andThen(consumer); } return consumer; }
@Override public void forEach(BiConsumer<? super Double, ? super Double> action) { if (action == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { action.accept(Double.longBitsToDouble(key), Double.longBitsToDouble(tab[i + 1])); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
void process(@NotNull final WireIn inWire, final WireOutPublisher publisher, final long tid, @NotNull final Wire outWire, final HostIdentifier hostId, final Replication replication, final EventLoop eventLoop) { this.eventLoop = eventLoop; setOutWire(outWire); this.hostId = hostId; this.publisher = publisher; this.replication = replication; this.tid = tid; dataConsumer.accept(inWire, tid); }
@Override public void forEach(BiConsumer<? super K, ? super V> action) { checkNotNull(action).accept(singleKey, singleValue); }
@Override public Dispatcher<String> exceptionHandler(BiConsumer<Throwable, RequestContext> handler) { this.exceptionHandler = exceptionHandler.andThen(handler); return this; }
@Override public void forEach(BiConsumer<? super Double, ? super Double> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); long[] tab = table; for (int i = tab.length - 2; i >= 0; i -= 2) { long key; if ((key = tab[i]) < FREE_BITS) { action.accept(Double.longBitsToDouble(key), Double.longBitsToDouble(tab[i + 1])); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
void process(@NotNull final WireIn inWire, @NotNull final RequestContext requestContext, @NotNull final WireOutPublisher publisher, @NotNull final Asset asset, final long tid, @NotNull final Wire outWire, @NotNull final TopologySubscription subscription) { setOutWire(outWire); this.outWire = outWire; this.subscription = subscription; this.requestContext = requestContext; this.publisher = publisher; this.asset = asset; assert dataConsumer != null; dataConsumer.accept(inWire, tid); }
@Override public void forEach(BiConsumer<? super K, ? super V> action) { checkNotNull(action); for (Entry<K, V> entry : entries) { action.accept(entry.getKey(), entry.getValue()); } }