Uses of Interface
com.google.mu.util.Both

Packages that use Both
Package
Description
StringFormat, Substring, Optionals and more...
BiStream, BiCollector, MoreStreams, MoreCollectors etc.
  • Uses of Both in com.google.mu.util

    Methods in com.google.mu.util that return Both
    Modifier and Type
    Method
    Description
    static <A, B> Both<A,B>
    Both.of(A a, B b)
    Returns an instance with both a and b.
    abstract Both<A,B>
    BiOptional.orElse(A a, B b)
    Returns the pair if present, or else returns (a, b).
    abstract Both<A,B>
    BiOptional.orElseThrow()
    Ensures that the pair must be present or else throws NoSuchElementException.
    final <E extends Throwable>
    Both<A,B>
    BiOptional.orElseThrow(String message, Object... args)
    Ensures that the pair must be present or else throws NoSuchElementException with message formatted with args.
    final <E extends Throwable>
    Both<A,B>
    BiOptional.orElseThrow(Function<String,E> exceptionFactory, String message, Object... args)
    Ensures that the pair must be present or else throws the exception returned by exceptionFactory with message formatted with args.
    abstract <E extends Throwable>
    Both<A,B>
    BiOptional.orElseThrow(Supplier<E> exceptionSupplier)
    Ensures that the pair must be present or else throws the exception returned by exceptionSupplier.
    default Both<A,B>
    Both.peek(BiConsumer<? super A,? super B> consumer)
    Invokes consumer with this pair and returns this object as is.
  • Uses of Both in com.google.mu.util.stream

    Methods in com.google.mu.util.stream that return types with arguments of type Both
    Modifier and Type
    Method
    Description
    static <T> Collector<T,?,Both<com.google.common.collect.ImmutableList<T>,com.google.common.collect.ImmutableList<T>>>
    GuavaCollectors.partitioningBy(Predicate<? super T> predicate)
    Returns a collector that partitions the incoming elements into two groups: elements that match predicate, and those that don't.
    static <E, R> Collector<E,?,Both<R,R>>
    MoreCollectors.partitioningBy(Predicate<? super E> predicate, Collector<E,?,R> downstream)
    Returns a collector that partitions the incoming elements into two groups: elements that match predicate, and those that don't.
    static <E, A1, A2, T, F>
    Collector<E,?,Both<T,F>>
    MoreCollectors.partitioningBy(Predicate<? super E> predicate, Collector<E,A1,T> downstreamIfTrue, Collector<E,A2,F> downstreamIfFalse)
    Returns a collector that partitions the incoming elements into two groups: elements that match predicate, and those that don't, and use downstreamIfTrue and downstreamIfFalse respectively to collect the elements.
    Method parameters in com.google.mu.util.stream with type arguments of type Both
    Modifier and Type
    Method
    Description
    static <K, V> BiStream<K,V>
    BiStream.from(Stream<? extends Both<? extends K,? extends V>> pairs)
    Returns a BiStream of the pairs from stream.
    final <K2, V2> BiStream<K2,V2>
    BiStream.map(BiFunction<? super K,? super V,? extends Both<? extends K2,? extends V2>> mapper)
    Returns a BiStream consisting of the result pairs of applying mapper to the pairs in this BiStream.
    static <K, V, K1, V1, R>
    BiCollector<K,V,R>
    BiCollectors.mapping(BiFunction<? super K,? super V,? extends Both<? extends K1,? extends V1>> mapper, BiCollector<K1,V1,R> downstream)
    Returns a BiCollector that first maps the input pair into another pair using mapper.
    static <T, A, B, R>
    Collector<T,?,R>
    MoreCollectors.mapping(Function<? super T,? extends Both<? extends A,? extends B>> mapper, BiCollector<A,B,R> downstream)
    Analogous to Collectors.mapping(), applies a mapping function to each input element before accumulation, except that the mapper function returns a pair of elements, which are then accumulated by a BiCollector.
    static <E, K, V> Collector<E,?,BiStream<K,V>>
    BiStream.toBiStream(Function<? super E,? extends Both<? extends K,? extends V>> toPair)
    Returns a Collector that splits each input element as a pair and collects them into a BiStream.
    static <T, K, V> Collector<T,?,com.google.common.collect.ImmutableBiMap<K,V>>
    GuavaCollectors.toImmutableBiMap(Function<? super T,? extends Both<? extends K,? extends V>> mapper)
    Returns a collector that first maps each input into a key-value pair, and then collects them into a ImmutableBiMap.
    static <T, K, V> Collector<T,?,com.google.common.collect.ImmutableListMultimap<K,V>>
    GuavaCollectors.toImmutableListMultimap(Function<? super T,? extends Both<? extends K,? extends V>> mapper)
    Returns a collector that first maps each input into a key-value pair, and then collects them into a ImmutableListMultimap.
    static <T, K, V> Collector<T,?,com.google.common.collect.ImmutableMap<K,V>>
    GuavaCollectors.toImmutableMap(Function<? super T,? extends Both<? extends K,? extends V>> mapper)
    Returns a collector that first maps each input into a key-value pair, and then collects them into a ImmutableMap.
    static <T, K, V> Collector<T,?,com.google.common.collect.ImmutableMap<K,V>>
    GuavaCollectors.toImmutableMapIgnoringDuplicateEntries(Function<? super T,? extends Both<? extends K,? extends V>> mapper)
    Returns a collector that first maps each input into a key-value pair, and then collects them into a ImmutableListMultimap.
    static <T, K, V> Collector<T,?,com.google.common.collect.ImmutableSetMultimap<K,V>>
    GuavaCollectors.toImmutableSetMultimap(Function<? super T,? extends Both<? extends K,? extends V>> mapper)
    Returns a collector that first maps each input into a key-value pair, and then collects them into a ImmutableSetMultimap.