List of usage examples for org.apache.commons.lang3.tuple Triple of
public static <L, M, R> Triple<L, M, R> of(final L left, final M middle, final R right)
Obtains an immutable triple of from three objects inferring the generic types.
This factory allows the triple to be created using inference to obtain the generic types.
From source file:at.gridtec.lambda4j.function.tri.conversion.TriShortToCharFunction.java
/** * Returns a memoized (caching) version of this {@link TriShortToCharFunction}. Whenever it is called, the mapping * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the * memoized value instead of computing the return value again. * <p>//from ww w . j av a 2s .c o m * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values * forever. * * @return A memoized (caching) version of this {@code TriShortToCharFunction}. * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the * resulting memoized function, as the cache used internally does not permit {@code null} keys or values. * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it * thread-safe. */ @Nonnull default TriShortToCharFunction memoized() { if (isMemoized()) { return this; } else { final Map<Triple<Short, Short, Short>, Character> cache = new ConcurrentHashMap<>(); final Object lock = new Object(); return (TriShortToCharFunction & Memoized) (value1, value2, value3) -> { final char returnValue; synchronized (lock) { returnValue = cache.computeIfAbsent(Triple.of(value1, value2, value3), key -> applyAsChar(key.getLeft(), key.getMiddle(), key.getRight())); } return returnValue; }; } }
From source file:at.gridtec.lambda4j.function.tri.conversion.TriByteToDoubleFunction.java
/** * Returns a memoized (caching) version of this {@link TriByteToDoubleFunction}. Whenever it is called, the mapping * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the * memoized value instead of computing the return value again. * <p>/*from ww w.j a v a2 s. com*/ * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values * forever. * * @return A memoized (caching) version of this {@code TriByteToDoubleFunction}. * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the * resulting memoized function, as the cache used internally does not permit {@code null} keys or values. * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it * thread-safe. */ @Nonnull default TriByteToDoubleFunction memoized() { if (isMemoized()) { return this; } else { final Map<Triple<Byte, Byte, Byte>, Double> cache = new ConcurrentHashMap<>(); final Object lock = new Object(); return (TriByteToDoubleFunction & Memoized) (value1, value2, value3) -> { final double returnValue; synchronized (lock) { returnValue = cache.computeIfAbsent(Triple.of(value1, value2, value3), key -> applyAsDouble(key.getLeft(), key.getMiddle(), key.getRight())); } return returnValue; }; } }
From source file:at.gridtec.lambda4j.function.tri.conversion.TriLongToDoubleFunction.java
/** * Returns a memoized (caching) version of this {@link TriLongToDoubleFunction}. Whenever it is called, the mapping * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the * memoized value instead of computing the return value again. * <p>//from w w w . j ava 2 s.c o m * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values * forever. * * @return A memoized (caching) version of this {@code TriLongToDoubleFunction}. * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the * resulting memoized function, as the cache used internally does not permit {@code null} keys or values. * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it * thread-safe. */ @Nonnull default TriLongToDoubleFunction memoized() { if (isMemoized()) { return this; } else { final Map<Triple<Long, Long, Long>, Double> cache = new ConcurrentHashMap<>(); final Object lock = new Object(); return (TriLongToDoubleFunction & Memoized) (value1, value2, value3) -> { final double returnValue; synchronized (lock) { returnValue = cache.computeIfAbsent(Triple.of(value1, value2, value3), key -> applyAsDouble(key.getLeft(), key.getMiddle(), key.getRight())); } return returnValue; }; } }
From source file:at.gridtec.lambda4j.function.tri.conversion.TriCharToDoubleFunction.java
/** * Returns a memoized (caching) version of this {@link TriCharToDoubleFunction}. Whenever it is called, the mapping * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the * memoized value instead of computing the return value again. * <p>/*from w ww . j a v a 2s . c om*/ * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values * forever. * * @return A memoized (caching) version of this {@code TriCharToDoubleFunction}. * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the * resulting memoized function, as the cache used internally does not permit {@code null} keys or values. * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it * thread-safe. */ @Nonnull default TriCharToDoubleFunction memoized() { if (isMemoized()) { return this; } else { final Map<Triple<Character, Character, Character>, Double> cache = new ConcurrentHashMap<>(); final Object lock = new Object(); return (TriCharToDoubleFunction & Memoized) (value1, value2, value3) -> { final double returnValue; synchronized (lock) { returnValue = cache.computeIfAbsent(Triple.of(value1, value2, value3), key -> applyAsDouble(key.getLeft(), key.getMiddle(), key.getRight())); } return returnValue; }; } }
From source file:at.gridtec.lambda4j.function.tri.conversion.TriDoubleToLongFunction.java
/** * Returns a memoized (caching) version of this {@link TriDoubleToLongFunction}. Whenever it is called, the mapping * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the * memoized value instead of computing the return value again. * <p>/*from w w w . j a v a2s.co m*/ * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values * forever. * * @return A memoized (caching) version of this {@code TriDoubleToLongFunction}. * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the * resulting memoized function, as the cache used internally does not permit {@code null} keys or values. * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it * thread-safe. */ @Nonnull default TriDoubleToLongFunction memoized() { if (isMemoized()) { return this; } else { final Map<Triple<Double, Double, Double>, Long> cache = new ConcurrentHashMap<>(); final Object lock = new Object(); return (TriDoubleToLongFunction & Memoized) (value1, value2, value3) -> { final long returnValue; synchronized (lock) { returnValue = cache.computeIfAbsent(Triple.of(value1, value2, value3), key -> applyAsLong(key.getLeft(), key.getMiddle(), key.getRight())); } return returnValue; }; } }
From source file:at.gridtec.lambda4j.function.tri.conversion.TriDoubleToByteFunction.java
/** * Returns a memoized (caching) version of this {@link TriDoubleToByteFunction}. Whenever it is called, the mapping * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the * memoized value instead of computing the return value again. * <p>//www. j av a2s . c o m * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values * forever. * * @return A memoized (caching) version of this {@code TriDoubleToByteFunction}. * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the * resulting memoized function, as the cache used internally does not permit {@code null} keys or values. * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it * thread-safe. */ @Nonnull default TriDoubleToByteFunction memoized() { if (isMemoized()) { return this; } else { final Map<Triple<Double, Double, Double>, Byte> cache = new ConcurrentHashMap<>(); final Object lock = new Object(); return (TriDoubleToByteFunction & Memoized) (value1, value2, value3) -> { final byte returnValue; synchronized (lock) { returnValue = cache.computeIfAbsent(Triple.of(value1, value2, value3), key -> applyAsByte(key.getLeft(), key.getMiddle(), key.getRight())); } return returnValue; }; } }
From source file:at.gridtec.lambda4j.function.tri.conversion.TriDoubleToCharFunction.java
/** * Returns a memoized (caching) version of this {@link TriDoubleToCharFunction}. Whenever it is called, the mapping * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the * memoized value instead of computing the return value again. * <p>/*from w w w . j a v a 2s . c o m*/ * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values * forever. * * @return A memoized (caching) version of this {@code TriDoubleToCharFunction}. * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the * resulting memoized function, as the cache used internally does not permit {@code null} keys or values. * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it * thread-safe. */ @Nonnull default TriDoubleToCharFunction memoized() { if (isMemoized()) { return this; } else { final Map<Triple<Double, Double, Double>, Character> cache = new ConcurrentHashMap<>(); final Object lock = new Object(); return (TriDoubleToCharFunction & Memoized) (value1, value2, value3) -> { final char returnValue; synchronized (lock) { returnValue = cache.computeIfAbsent(Triple.of(value1, value2, value3), key -> applyAsChar(key.getLeft(), key.getMiddle(), key.getRight())); } return returnValue; }; } }
From source file:at.gridtec.lambda4j.function.tri.conversion.TriFloatToShortFunction.java
/** * Returns a memoized (caching) version of this {@link TriFloatToShortFunction}. Whenever it is called, the mapping * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the * memoized value instead of computing the return value again. * <p>//from w w w . j a v a 2 s .c o m * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values * forever. * * @return A memoized (caching) version of this {@code TriFloatToShortFunction}. * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the * resulting memoized function, as the cache used internally does not permit {@code null} keys or values. * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it * thread-safe. */ @Nonnull default TriFloatToShortFunction memoized() { if (isMemoized()) { return this; } else { final Map<Triple<Float, Float, Float>, Short> cache = new ConcurrentHashMap<>(); final Object lock = new Object(); return (TriFloatToShortFunction & Memoized) (value1, value2, value3) -> { final short returnValue; synchronized (lock) { returnValue = cache.computeIfAbsent(Triple.of(value1, value2, value3), key -> applyAsShort(key.getLeft(), key.getMiddle(), key.getRight())); } return returnValue; }; } }
From source file:at.gridtec.lambda4j.function.tri.conversion.TriShortToFloatFunction.java
/** * Returns a memoized (caching) version of this {@link TriShortToFloatFunction}. Whenever it is called, the mapping * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the * memoized value instead of computing the return value again. * <p>/*from w ww .j av a 2 s.c o m*/ * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values * forever. * * @return A memoized (caching) version of this {@code TriShortToFloatFunction}. * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the * resulting memoized function, as the cache used internally does not permit {@code null} keys or values. * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it * thread-safe. */ @Nonnull default TriShortToFloatFunction memoized() { if (isMemoized()) { return this; } else { final Map<Triple<Short, Short, Short>, Float> cache = new ConcurrentHashMap<>(); final Object lock = new Object(); return (TriShortToFloatFunction & Memoized) (value1, value2, value3) -> { final float returnValue; synchronized (lock) { returnValue = cache.computeIfAbsent(Triple.of(value1, value2, value3), key -> applyAsFloat(key.getLeft(), key.getMiddle(), key.getRight())); } return returnValue; }; } }
From source file:at.gridtec.lambda4j.function.tri.conversion.TriFloatToDoubleFunction.java
/** * Returns a memoized (caching) version of this {@link TriFloatToDoubleFunction}. Whenever it is called, the mapping * between the input parameters and the return value is preserved in a cache, making subsequent calls returning the * memoized value instead of computing the return value again. * <p>// ww w .j a va 2s . c o m * Unless the function and therefore the used cache will be garbage-collected, it will keep all memoized values * forever. * * @return A memoized (caching) version of this {@code TriFloatToDoubleFunction}. * @implSpec This implementation does not allow the input parameters or return value to be {@code null} for the * resulting memoized function, as the cache used internally does not permit {@code null} keys or values. * @implNote The returned memoized function can be safely used concurrently from multiple threads which makes it * thread-safe. */ @Nonnull default TriFloatToDoubleFunction memoized() { if (isMemoized()) { return this; } else { final Map<Triple<Float, Float, Float>, Double> cache = new ConcurrentHashMap<>(); final Object lock = new Object(); return (TriFloatToDoubleFunction & Memoized) (value1, value2, value3) -> { final double returnValue; synchronized (lock) { returnValue = cache.computeIfAbsent(Triple.of(value1, value2, value3), key -> applyAsDouble(key.getLeft(), key.getMiddle(), key.getRight())); } return returnValue; }; } }