Refine search
private static void printValue( PrintStream out, long value, String description, LongFunction<String> toStringConverter ) { if ( value > 0 ) { printIndented( out, description + ": " + toStringConverter.apply( value ) ); } }
/** * If a value is present in the {@code OptionalLong}, apply the provided long mapping function to it, and if the * result is non-null, return an {@code Optional} describing the result. Otherwise return an empty {@code Optional}. */ public static <T> Optional<T> mapToObj(OptionalLong self, LongFunction<? extends T> mapper) { Objects.requireNonNull(mapper); if (self.isPresent()) { return Optional.ofNullable(mapper.apply(self.getAsLong())); } else { return Optional.empty(); } }
/** {@inheritDoc} */ @Override public V computeIfAbsent(final long k, final java.util.function.LongFunction<? extends V> mappingFunction) { java.util.Objects.requireNonNull(mappingFunction); final int pos = find(k); if (pos >= 0) return value[pos]; final V newValue = mappingFunction.apply(k); insert(-pos - 1, k, newValue); return newValue; } /** {@inheritDoc} */
/** {@inheritDoc} */ @Override public V computeIfAbsent(final long k, final java.util.function.LongFunction<? extends V> mappingFunction) { java.util.Objects.requireNonNull(mappingFunction); final int pos = find(k); if (pos >= 0) return value[pos]; final V newValue = mappingFunction.apply(k); insert(-pos - 1, k, newValue); return newValue; } /** {@inheritDoc} */
@Override public T readObject(ObjectInput input) throws IOException, ClassNotFoundException { return this.reader.apply(input.readLong()); }
/** {@inheritDoc} */ @Override public V computeIfAbsent(final long k, final java.util.function.LongFunction<? extends V> mappingFunction) { java.util.Objects.requireNonNull(mappingFunction); final int pos = find(k); if (pos >= 0) return value[pos]; final V newValue = mappingFunction.apply(k); insert(-pos - 1, k, newValue); return newValue; } /** {@inheritDoc} */
private static <T> void readNonNullLongColumn(Object[] vals, int fieldIdx, LongColumnVector vector, int childCount, LongFunction<T> reader) { if (vector.isRepeating) { // fill complete column with first value T repeatingValue = reader.apply(vector.vector[0]); fillColumnWithRepeatingValue(vals, fieldIdx, repeatingValue, childCount); } else { if (fieldIdx == -1) { // set as an object for (int i = 0; i < childCount; i++) { vals[i] = reader.apply(vector.vector[i]); } } else { // set as a field of Row Row[] rows = (Row[]) vals; for (int i = 0; i < childCount; i++) { rows[i].setField(fieldIdx, reader.apply(vector.vector[i])); } } } }
/** {@inheritDoc} */ @Override public V computeIfAbsent(final long k, final java.util.function.LongFunction<? extends V> mappingFunction) { java.util.Objects.requireNonNull(mappingFunction); final int pos = find(k); if (pos >= 0) return value[pos]; final V newValue = mappingFunction.apply(k); insert(-pos - 1, k, newValue); return newValue; } /** {@inheritDoc} */
@Override public T next() { return mapFunction.apply( source.next() ); }
/** {@inheritDoc} */ @Override public V computeIfAbsent(final long k, final java.util.function.LongFunction<? extends V> mappingFunction) { java.util.Objects.requireNonNull(mappingFunction); final int pos = find(k); if (pos >= 0) return value[pos]; final V newValue = mappingFunction.apply(k); insert(-pos - 1, k, newValue); return newValue; } /** {@inheritDoc} */
@Override public T next() { return mapper.apply( iterator.next() ); } };
/** {@inheritDoc} */ @Override public V computeIfAbsent(final long k, final java.util.function.LongFunction<? extends V> mappingFunction) { java.util.Objects.requireNonNull(mappingFunction); final int pos = find(k); if (pos >= 0) return value[pos]; final V newValue = mappingFunction.apply(k); insert(-pos - 1, k, newValue); return newValue; } /** {@inheritDoc} */
@Override public T next() { return mapFunction.apply( source.next() ); }
@Override public void initialize(LayeredZoneRegionFunction parent) { noise = seededNoiseFunction.apply(parent.getSeed()); }
@Override public boolean next(Predicate<? super T> consumer) { return source.next(e -> consumer.test(mapper.apply(e))); }
default VALUE computeIfAbsent( long key, LongFunction<VALUE> function ) { VALUE value = get( key ); if ( value == null ) { value = function.apply( key ); put( key, value ); } return value; } }
@Override public synchronized boolean next( InputChunk chunk ) { if ( numberOfBatches > 1 ) { numberOfBatches--; long batch = nextBatch++; ((Chunk) chunk).initialize( states.apply( batch ), batch, batchSize ); return true; } else if ( numberOfBatches == 1 ) { numberOfBatches--; int rest = toIntExact( totalCount % batchSize ); int size = rest != 0 ? rest : batchSize; long batch = nextBatch++; ((Chunk) chunk).initialize( states.apply( batch ), batch, size ); return true; } return false; }
/** * Deparse an action bit set, using the given function to map action bits to strings. If the bits are all clear, * the empty string {@code ""} is returned. * * @param actionBits the action bit set * @param mappingFunction the mapping function (must not be {@code null}) * @return the actions string (not {@code null}) */ public static String toActionsString(long actionBits, LongFunction<String> mappingFunction) { Assert.checkNotNullParam("mappingFunction", mappingFunction); final StringBuilder sb = new StringBuilder(); if (actionBits == 0) return ""; long lb = Long.highestOneBit(actionBits); sb.append(mappingFunction.apply(lb)); actionBits &= ~lb; while (actionBits != 0) { lb = Long.highestOneBit(actionBits); sb.append(',').append(mappingFunction.apply(lb)); actionBits &= ~lb; } return sb.toString(); }
@Override protected T fetchNextOrNull() { if ( cursor.next() ) { return mapper.apply( cursor.nodeReference() ); } else { close(); return null; } }
@Override protected T fetchNextOrNull() { if ( cursor.next() ) { return mapper.apply( cursor.relationshipReference() ); } else { close(); return null; } }