Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bitbucket.cowwoc.guava.stream;
  
 import static java.util.stream.Collector.Characteristics.UNORDERED;

Captures the type of the input elements.

Parameters:
<T> the type of the input elements
Author(s):
Gili Tzabari
 
 public final class GuavaCollectorBuilder<T>
 {
Meant to be constructed by GuavaCollector.
 
 	{
 	}

Returns a builder for a Collector that accumulates elements into a Multimap.

The default intermediate container is not thread-safe. Use MultimapCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Parameters:
<K> the type of the map keys
<V> the type of the map values
keyMapper a function that transforms the input to map keys
valueMapper a function that transforms the input to map values
Returns:
a builder for a Multimap collector
Throws:
java.lang.NullPointerException if any of the arguments are null
 
 	public <K, V> MultimapCollectorBuilder<T, K, V, Multimap<K, V>> toMultimap(
 		Function<? super T, ? extends K> keyMapper,
 		Function<? super T, ? extends V> valueMapper)
 	{
 		return new MultimapCollectorBuilder<>(keyMappervalueMapper, ArrayListMultimap::create,
 	}

Returns a builder for a Collector that accumulates elements into an ImmutableMultimap.

The default intermediate container is not thread-safe. Use MultimapCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Parameters:
<K> the type of the map keys
<V> the type of the map values
keyMapper a function that transforms the input to map keys
valueMapper a function that transforms the input to map values
Returns:
a builder for an ImmutableMultimap collector
Throws:
java.lang.NullPointerException if any of the arguments are null
 
 	public <K, V>
 			Function<? super T, ? extends K> keyMapperFunction<? super T, ? extends V> valueMapper)
 	{
 		return new MultimapCollectorBuilder<>(keyMappervalueMapper, ArrayListMultimap::create,
 			ImmutableMultimap::copyOf, .);
 	}

Returns a builder for a Collector that accumulates elements into an ImmutableMultiset.

The default intermediate container is not thread-safe. Use MultisetCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Returns:
a builder for an ImmutableMultiset collector
 
 	{
		return new MultisetCollectorBuilder<>(HashMultiset::create, ImmutableMultiset::copyOf,
	}

Returns a builder for a Collector that accumulates elements into an ImmutableMap.

The default intermediate container is not thread-safe. Use MapCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Parameters:
<K> the type of the map keys
<V> the type of the map values
keyMapper a function that transforms the map keys
valueMapper a function that transforms the map values
Returns:
a builder for a ImmutableMap collector
Throws:
java.lang.NullPointerException if any of the arguments are null
	public <K, V> MapCollectorBuilder<T, K, V, ImmutableMap<K, V>> toImmutableMap(
		Function<? super T, ? extends K> keyMapper,
		Function<? super T, ? extends V> valueMapper)
	{
		return new MapCollectorBuilder<>(keyMappervalueMapper, HashMap::new, ImmutableMap::copyOf,
	}

Returns a builder for a Collector that accumulates elements into an ImmutableSortedMap.

The default intermediate container is not thread-safe. Use MapCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Parameters:
<K> the type of the map keys
<V> the type of the map values
keyMapper a function that transforms the map keys
valueMapper a function that transforms the map values
comparator a comparator that defines the sort order of the keys
Returns:
a builder for an ImmutableSortedMap collector
Throws:
java.lang.NullPointerException if any of the arguments are null
See also:
java.util.Comparator.naturalOrder()
	public <K, V> MapCollectorBuilder<T, K, V, ImmutableSortedMap<K, V>>
		toImmutableSortedMap(Function<? super T, ? extends K> keyMapper,
			Function<? super T, ? extends V> valueMapperComparator<K> comparator)
	{
		return new MapCollectorBuilder<>(keyMappervalueMapper, HashMap::new,
			input -> ImmutableSortedMap.copyOf(inputcomparator));
	}

Returns a builder for a Collector that accumulates elements into an ImmutableBiMap.

The default intermediate container is not thread-safe. Use MultimapCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Parameters:
<K> the type of the map keys
<V> the type of the map values
keyMapper a function that transforms the map keys
valueMapper a function that transforms the map values
Returns:
a builder for an ImmutableBiMap collector
Throws:
java.lang.NullPointerException if any of the arguments are null
	public <K, V> MapCollectorBuilder<T, K, V, ImmutableBiMap<K, V>>
		toImmutableBiMap(Function<? super T, ? extends K> keyMapper,
			Function<? super T, ? extends V> valueMapper)
	{
		return new MapCollectorBuilder<>(keyMappervalueMapper, HashBiMap::create,
			ImmutableBiMap::copyOf, );
	}

Returns a builder for a Collector that accumulates elements into an ImmutableList.

The default intermediate container is not thread-safe. Use ListCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Returns:
a builder for an ImmutableList collector
	{
		return new ListCollectorBuilder<>(ArrayList::new, ImmutableList::copyOf);
	}

Returns a builder for a Collector that accumulates elements into an ImmutableSet.

The default intermediate container is not thread-safe. Use SetCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Returns:
a builder for an ImmutableSet collector
	{
		return new SetCollectorBuilder<>(HashSet::new, ImmutableSet::copyOf);
	}

Returns a builder for a Collector that accumulates elements into an ImmutableSortedSet.

The default intermediate container is not thread-safe. Use SetCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Parameters:
comparator a comparator that defines the sort order of the keys
Returns:
a builder for an ImmutableSortedSet collector
Throws:
java.lang.NullPointerException if any of the arguments are null
See also:
java.util.Comparator.naturalOrder()
		Comparator<T> comparator)
	{
		return new SetCollectorBuilder<>(HashSet::new, ImmutableSortedSet::copyOf);
	}

Returns a builder for a Collector that accumulates elements into an ImmutableSortedSet.

The default intermediate container is not thread-safe. Use MultisetCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Parameters:
comparator a comparator that defines the sort order of the elements
Returns:
a builder for an ImmutableSortedSet collector
Throws:
java.lang.NullPointerException if any of the arguments are null
See also:
java.util.Comparator.naturalOrder()
	{
		return new MultisetCollectorBuilder<>(() -> TreeMultiset.create(comparator),
			input -> ImmutableSortedMultiset.copyOf(comparatorinput));
	}

Returns a builder for a Collector that accumulates elements into an ImmutableListMultimap.

The default intermediate container is not thread-safe. Use MultimapCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Parameters:
<K> the type of the map keys
<V> the type of the map values
keyMapper a function that transforms the input to map keys
valueMapper a function that transforms the input to map values
Returns:
a builder for an ImmutableListMultimap collector
Throws:
java.lang.NullPointerException if any of the arguments are null
	public <K, V> MultimapCollectorBuilder<T, K, V, ImmutableListMultimap<K, V>>
		toImmutableListMultimap(Function<? super T, ? extends K> keyMapper,
			Function<? super T, ? extends V> valueMapper)
	{
		return new MultimapCollectorBuilder<>(keyMappervalueMapper, ArrayListMultimap::create,
			ImmutableListMultimap::copyOf);
	}

Returns a builder for a Collector that accumulates elements into an ImmutableSetMultimap.

The default intermediate container is not thread-safe. Use MultimapCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Parameters:
<K> the type of the map keys
<V> the type of the map values
keyMapper a function that transforms the input to map keys
valueMapper a function that transforms the input to map values
Returns:
a builder for an ImmutableListMultimap collector
Throws:
java.lang.NullPointerException if any of the arguments are null
	public <K, V> ImmutableSetMultimapCollectorBuilder<T, K, V>
		toImmutableSetMultimap(Function<? super T, ? extends K> keyMapper,
			Function<? super T, ? extends V> valueMapper)
	{
		return new ImmutableSetMultimapCollectorBuilder<>(keyMappervalueMapper, HashMultimap::create,
	}

Returns a builder for a Collector that accumulates elements into an ImmutableTable.

The default intermediate container is not thread-safe. Use TableCollectorBuilder.supplier(java.util.function.Supplier) to replace it.

Parameters:
<R> the type of the table rows
<C> the type of the table columns
<V> the type of the table values
rowMapper a function that transforms the input to table rows
columnMapper a function that transforms the input to table columns
valueMapper a function that transforms the input to table values
Returns:
a builder for an ImmutableListMultimap collector
Throws:
java.lang.NullPointerException if any of the arguments are null
	public <R, C, V> ImmutableTableCollectorBuilder<T, R, C, V>
		toImmutableTable(Function<? super T, ? extends R> rowMapper,
			Function<? super T, ? extends C> columnMapper,
			Function<? super T, ? extends V> valueMapper)
	{
		return new ImmutableTableCollectorBuilder<>(rowMappercolumnMappervalueMapper,
			HashBasedTable::create, );
	}
New to GrepCode? Check out our FAQ X