Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.eclipse.collections.impl.factory.Multimaps Maven / Gradle / Ivy
/*
* Copyright (c) 2016 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*/
package org.eclipse.collections.impl.factory;
import java.util.Comparator;
import org.eclipse.collections.api.multimap.Multimap;
import org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap;
import org.eclipse.collections.api.multimap.bag.MutableBagMultimap;
import org.eclipse.collections.api.multimap.list.ImmutableListMultimap;
import org.eclipse.collections.api.multimap.list.MutableListMultimap;
import org.eclipse.collections.api.multimap.set.ImmutableSetMultimap;
import org.eclipse.collections.api.multimap.set.MutableSetMultimap;
import org.eclipse.collections.api.multimap.sortedbag.MutableSortedBagMultimap;
import org.eclipse.collections.api.multimap.sortedset.ImmutableSortedSetMultimap;
import org.eclipse.collections.api.multimap.sortedset.MutableSortedSetMultimap;
import org.eclipse.collections.impl.multimap.bag.HashBagMultimap;
import org.eclipse.collections.impl.multimap.bag.ImmutableBagMultimapImpl;
import org.eclipse.collections.impl.multimap.bag.sorted.mutable.TreeBagMultimap;
import org.eclipse.collections.impl.multimap.list.FastListMultimap;
import org.eclipse.collections.impl.multimap.list.ImmutableListMultimapImpl;
import org.eclipse.collections.impl.multimap.set.ImmutableSetMultimapImpl;
import org.eclipse.collections.impl.multimap.set.UnifiedSetMultimap;
import org.eclipse.collections.impl.multimap.set.sorted.ImmutableSortedSetMultimapImpl;
import org.eclipse.collections.impl.multimap.set.sorted.TreeSortedSetMultimap;
@SuppressWarnings("ConstantNamingConvention")
public final class Multimaps
{
public static final ImmutableMultimaps immutable = new ImmutableMultimaps();
public static final MutableMultimaps mutable = new MutableMultimaps();
private Multimaps()
{
throw new AssertionError("Suppress default constructor for noninstantiability");
}
@SuppressWarnings("PublicField")
public static final class ImmutableMultimaps
{
public final ImmutableListMultimapFactory list = new ImmutableListMultimapFactory();
public final ImmutableSetMultimapFactory set = new ImmutableSetMultimapFactory();
public final ImmutableSortedSetMultimapFactory sortedSet = new ImmutableSortedSetMultimapFactory();
public final ImmutableBagMultimapFactory bag = new ImmutableBagMultimapFactory();
private ImmutableMultimaps()
{
}
public static final class ImmutableListMultimapFactory
{
public static final ImmutableListMultimap EMPTY = new ImmutableListMultimapImpl<>(Maps.immutable.with());
private ImmutableListMultimapFactory()
{
}
public ImmutableListMultimap empty()
{
return (ImmutableListMultimap) EMPTY;
}
public ImmutableListMultimap of()
{
return this.empty();
}
public ImmutableListMultimap with()
{
return this.empty();
}
public ImmutableListMultimap of(K key, V value)
{
return this.with(key, value);
}
public ImmutableListMultimap with(K key, V value)
{
return new ImmutableListMultimapImpl<>(Maps.immutable.with(key, Lists.immutable.with(value)));
}
public ImmutableListMultimap of(K key1, V value1, K key2, V value2)
{
return this.with(key1, value1, key2, value2);
}
public ImmutableListMultimap with(K key1, V value1, K key2, V value2)
{
FastListMultimap fastListMultimap = FastListMultimap.newMultimap();
fastListMultimap.put(key1, value1);
fastListMultimap.put(key2, value2);
return fastListMultimap.toImmutable();
}
public ImmutableListMultimap of(K key1, V value1, K key2, V value2, K key3, V value3)
{
return this.with(key1, value1, key2, value2, key3, value3);
}
public ImmutableListMultimap with(K key1, V value1, K key2, V value2, K key3, V value3)
{
FastListMultimap fastListMultimap = FastListMultimap.newMultimap();
fastListMultimap.put(key1, value1);
fastListMultimap.put(key2, value2);
fastListMultimap.put(key3, value3);
return fastListMultimap.toImmutable();
}
}
public static final class ImmutableSetMultimapFactory
{
public static final ImmutableSetMultimap EMPTY = new ImmutableSetMultimapImpl<>(Maps.immutable.with());
private ImmutableSetMultimapFactory()
{
}
public ImmutableSetMultimap empty()
{
return (ImmutableSetMultimap) EMPTY;
}
public ImmutableSetMultimap of()
{
return this.empty();
}
public ImmutableSetMultimap with()
{
return this.empty();
}
public ImmutableSetMultimap of(K key, V value)
{
return this.with(key, value);
}
public ImmutableSetMultimap with(K key, V value)
{
return new ImmutableSetMultimapImpl<>(Maps.immutable.with(key, Sets.immutable.with(value)));
}
public ImmutableSetMultimap of(K key1, V value1, K key2, V value2)
{
return this.with(key1, value1, key2, value2);
}
public ImmutableSetMultimap with(K key1, V value1, K key2, V value2)
{
UnifiedSetMultimap unifiedSetMultimap = UnifiedSetMultimap.newMultimap();
unifiedSetMultimap.put(key1, value1);
unifiedSetMultimap.put(key2, value2);
return unifiedSetMultimap.toImmutable();
}
public ImmutableSetMultimap of(K key1, V value1, K key2, V value2, K key3, V value3)
{
return this.with(key1, value1, key2, value2, key3, value3);
}
public ImmutableSetMultimap with(K key1, V value1, K key2, V value2, K key3, V value3)
{
UnifiedSetMultimap unifiedSetMultimap = UnifiedSetMultimap.newMultimap();
unifiedSetMultimap.put(key1, value1);
unifiedSetMultimap.put(key2, value2);
unifiedSetMultimap.put(key3, value3);
return unifiedSetMultimap.toImmutable();
}
}
public static final class ImmutableSortedSetMultimapFactory
{
private ImmutableSortedSetMultimapFactory()
{
}
public ImmutableSortedSetMultimap of(Comparator comparator)
{
return this.with(comparator);
}
public ImmutableSortedSetMultimap with(Comparator comparator)
{
return new ImmutableSortedSetMultimapImpl<>(Maps.immutable.with(), comparator);
}
public ImmutableSortedSetMultimap of(Comparator comparator, K key, V value)
{
return this.with(comparator, key, value);
}
public ImmutableSortedSetMultimap with(Comparator comparator, K key, V value)
{
return new ImmutableSortedSetMultimapImpl<>(Maps.immutable.with(key, SortedSets.immutable.with(comparator, value)), comparator);
}
public ImmutableSortedSetMultimap of(Comparator comparator, K key1, V value1, K key2, V value2)
{
return this.with(comparator, key1, value1, key2, value2);
}
public ImmutableSortedSetMultimap with(Comparator comparator, K key1, V value1, K key2, V value2)
{
TreeSortedSetMultimap treeSortedSetMultimap = TreeSortedSetMultimap.newMultimap(comparator);
treeSortedSetMultimap.put(key1, value1);
treeSortedSetMultimap.put(key2, value2);
return treeSortedSetMultimap.toImmutable();
}
public ImmutableSortedSetMultimap of(Comparator comparator, K key1, V value1, K key2, V value2, K key3, V value3)
{
return this.with(comparator, key1, value1, key2, value2, key3, value3);
}
public ImmutableSortedSetMultimap with(Comparator comparator, K key1, V value1, K key2, V value2, K key3, V value3)
{
TreeSortedSetMultimap treeSortedSetMultimap = TreeSortedSetMultimap.newMultimap(comparator);
treeSortedSetMultimap.put(key1, value1);
treeSortedSetMultimap.put(key2, value2);
treeSortedSetMultimap.put(key3, value3);
return treeSortedSetMultimap.toImmutable();
}
}
public static final class ImmutableBagMultimapFactory
{
public static final ImmutableBagMultimap EMPTY = new ImmutableBagMultimapImpl<>(Maps.immutable.with());
private ImmutableBagMultimapFactory()
{
}
public ImmutableBagMultimap empty()
{
return (ImmutableBagMultimap) EMPTY;
}
public ImmutableBagMultimap of()
{
return this.empty();
}
public ImmutableBagMultimap with()
{
return this.empty();
}
public ImmutableBagMultimap of(K key, V value)
{
return this.with(key, value);
}
public ImmutableBagMultimap with(K key, V value)
{
return new ImmutableBagMultimapImpl<>(Maps.immutable.with(key, Bags.immutable.with(value)));
}
public ImmutableBagMultimap of(K key1, V value1, K key2, V value2)
{
return this.with(key1, value1, key2, value2);
}
public ImmutableBagMultimap with(K key1, V value1, K key2, V value2)
{
HashBagMultimap hashBagMultimap = HashBagMultimap.newMultimap();
hashBagMultimap.put(key1, value1);
hashBagMultimap.put(key2, value2);
return hashBagMultimap.toImmutable();
}
public ImmutableBagMultimap of(K key1, V value1, K key2, V value2, K key3, V value3)
{
return this.with(key1, value1, key2, value2, key3, value3);
}
public ImmutableBagMultimap with(K key1, V value1, K key2, V value2, K key3, V value3)
{
HashBagMultimap hashBagMultimap = HashBagMultimap.newMultimap();
hashBagMultimap.put(key1, value1);
hashBagMultimap.put(key2, value2);
hashBagMultimap.put(key3, value3);
return hashBagMultimap.toImmutable();
}
}
}
@SuppressWarnings("PublicField")
public static final class MutableMultimaps
{
public final MutableListMultimapFactory list = new MutableListMultimapFactory();
public final MutableSetMultimapFactory set = new MutableSetMultimapFactory();
public final MutableSortedSetMultimapFactory sortedSet = new MutableSortedSetMultimapFactory();
public final MutableBagMultimapFactory bag = new MutableBagMultimapFactory();
public final MutableSortedBagMultimapFactory sortedBag = new MutableSortedBagMultimapFactory();
private MutableMultimaps()
{
}
public static final class MutableListMultimapFactory
{
private MutableListMultimapFactory()
{
}
public MutableListMultimap empty()
{
return FastListMultimap.newMultimap();
}
public MutableListMultimap of()
{
return this.empty();
}
public MutableListMultimap with()
{
return this.empty();
}
public MutableListMultimap of(K key, V value)
{
return this.with(key, value);
}
public MutableListMultimap with(K key, V value)
{
FastListMultimap fastListMultimap = FastListMultimap.newMultimap();
fastListMultimap.put(key, value);
return fastListMultimap;
}
public MutableListMultimap of(K key1, V value1, K key2, V value2)
{
return this.with(key1, value1, key2, value2);
}
public MutableListMultimap with(K key1, V value1, K key2, V value2)
{
FastListMultimap fastListMultimap = FastListMultimap.newMultimap();
fastListMultimap.put(key1, value1);
fastListMultimap.put(key2, value2);
return fastListMultimap;
}
public MutableListMultimap of(K key1, V value1, K key2, V value2, K key3, V value3)
{
return this.with(key1, value1, key2, value2, key3, value3);
}
public MutableListMultimap with(K key1, V value1, K key2, V value2, K key3, V value3)
{
FastListMultimap fastListMultimap = FastListMultimap.newMultimap();
fastListMultimap.put(key1, value1);
fastListMultimap.put(key2, value2);
fastListMultimap.put(key3, value3);
return fastListMultimap;
}
public MutableListMultimap withAll(Multimap extends K, ? extends V> multimap)
{
return new FastListMultimap(multimap);
}
}
public static final class MutableSetMultimapFactory
{
private MutableSetMultimapFactory()
{
}
public MutableSetMultimap empty()
{
return UnifiedSetMultimap.newMultimap();
}
public MutableSetMultimap of()
{
return this.empty();
}
public MutableSetMultimap with()
{
return this.empty();
}
public MutableSetMultimap of(K key, V value)
{
return this.with(key, value);
}
public MutableSetMultimap with(K key, V value)
{
UnifiedSetMultimap unifiedSetMultimap = UnifiedSetMultimap.newMultimap();
unifiedSetMultimap.put(key, value);
return unifiedSetMultimap;
}
public MutableSetMultimap of(K key1, V value1, K key2, V value2)
{
return this.with(key1, value1, key2, value2);
}
public MutableSetMultimap with(K key1, V value1, K key2, V value2)
{
UnifiedSetMultimap unifiedSetMultimap = UnifiedSetMultimap.newMultimap();
unifiedSetMultimap.put(key1, value1);
unifiedSetMultimap.put(key2, value2);
return unifiedSetMultimap;
}
public MutableSetMultimap of(K key1, V value1, K key2, V value2, K key3, V value3)
{
return this.with(key1, value1, key2, value2, key3, value3);
}
public MutableSetMultimap with(K key1, V value1, K key2, V value2, K key3, V value3)
{
UnifiedSetMultimap unifiedSetMultimap = UnifiedSetMultimap.newMultimap();
unifiedSetMultimap.put(key1, value1);
unifiedSetMultimap.put(key2, value2);
unifiedSetMultimap.put(key3, value3);
return unifiedSetMultimap;
}
public MutableSetMultimap withAll(Multimap extends K, ? extends V> multimap)
{
return new UnifiedSetMultimap(multimap);
}
}
public static final class MutableSortedSetMultimapFactory
{
private MutableSortedSetMultimapFactory()
{
}
public MutableSortedSetMultimap of(Comparator comparator)
{
return this.with(comparator);
}
public MutableSortedSetMultimap with(Comparator comparator)
{
return TreeSortedSetMultimap.newMultimap(comparator);
}
public MutableSortedSetMultimap of(Comparator comparator, K key, V value)
{
return this.with(comparator, key, value);
}
public MutableSortedSetMultimap with(Comparator comparator, K key, V value)
{
TreeSortedSetMultimap treeSortedSetMultimap = TreeSortedSetMultimap.newMultimap(comparator);
treeSortedSetMultimap.put(key, value);
return treeSortedSetMultimap;
}
public MutableSortedSetMultimap of(Comparator comparator, K key1, V value1, K key2, V value2)
{
return this.with(comparator, key1, value1, key2, value2);
}
public MutableSortedSetMultimap with(Comparator comparator, K key1, V value1, K key2, V value2)
{
TreeSortedSetMultimap treeSortedSetMultimap = TreeSortedSetMultimap.newMultimap(comparator);
treeSortedSetMultimap.put(key1, value1);
treeSortedSetMultimap.put(key2, value2);
return treeSortedSetMultimap;
}
public MutableSortedSetMultimap of(Comparator comparator, K key1, V value1, K key2, V value2, K key3, V value3)
{
return this.with(comparator, key1, value1, key2, value2, key3, value3);
}
public MutableSortedSetMultimap with(Comparator comparator, K key1, V value1, K key2, V value2, K key3, V value3)
{
TreeSortedSetMultimap treeSortedSetMultimap = TreeSortedSetMultimap.newMultimap(comparator);
treeSortedSetMultimap.put(key1, value1);
treeSortedSetMultimap.put(key2, value2);
treeSortedSetMultimap.put(key3, value3);
return treeSortedSetMultimap;
}
public MutableSortedSetMultimap withAll(Multimap extends K, ? extends V> multimap)
{
return new TreeSortedSetMultimap(multimap);
}
}
public static final class MutableBagMultimapFactory
{
private MutableBagMultimapFactory()
{
}
public MutableBagMultimap empty()
{
return HashBagMultimap.newMultimap();
}
public MutableBagMultimap of()
{
return this.empty();
}
public MutableBagMultimap with()
{
return this.empty();
}
public MutableBagMultimap of(K key, V value)
{
return this.with(key, value);
}
public MutableBagMultimap with(K key, V value)
{
HashBagMultimap hashBagMultimap = HashBagMultimap.newMultimap();
hashBagMultimap.put(key, value);
return hashBagMultimap;
}
public MutableBagMultimap of(K key1, V value1, K key2, V value2)
{
return this.with(key1, value1, key2, value2);
}
public MutableBagMultimap with(K key1, V value1, K key2, V value2)
{
HashBagMultimap hashBagMultimap = HashBagMultimap.newMultimap();
hashBagMultimap.put(key1, value1);
hashBagMultimap.put(key2, value2);
return hashBagMultimap;
}
public MutableBagMultimap of(K key1, V value1, K key2, V value2, K key3, V value3)
{
return this.with(key1, value1, key2, value2, key3, value3);
}
public MutableBagMultimap with(K key1, V value1, K key2, V value2, K key3, V value3)
{
HashBagMultimap hashBagMultimap = HashBagMultimap.newMultimap();
hashBagMultimap.put(key1, value1);
hashBagMultimap.put(key2, value2);
hashBagMultimap.put(key3, value3);
return hashBagMultimap;
}
public MutableBagMultimap withAll(Multimap extends K, ? extends V> multimap)
{
return new HashBagMultimap(multimap);
}
}
public static final class MutableSortedBagMultimapFactory
{
private MutableSortedBagMultimapFactory()
{
}
public MutableSortedBagMultimap empty()
{
return TreeBagMultimap.newMultimap();
}
public MutableSortedBagMultimap with()
{
return this.empty();
}
public MutableSortedBagMultimap with(K key, V value)
{
TreeBagMultimap treeBagMultimap = TreeBagMultimap.newMultimap();
treeBagMultimap.put(key, value);
return treeBagMultimap;
}
public MutableSortedBagMultimap with(K key1, V value1, K key2, V value2)
{
TreeBagMultimap treeBagMultimap = TreeBagMultimap.newMultimap();
treeBagMultimap.put(key1, value1);
treeBagMultimap.put(key2, value2);
return treeBagMultimap;
}
public MutableSortedBagMultimap with(K key1, V value1, K key2, V value2, K key3, V value3)
{
TreeBagMultimap treeBagMultimap = TreeBagMultimap.newMultimap();
treeBagMultimap.put(key1, value1);
treeBagMultimap.put(key2, value2);
treeBagMultimap.put(key3, value3);
return treeBagMultimap;
}
public MutableSortedBagMultimap withAll(Multimap extends K, ? extends V> multimap)
{
return new TreeBagMultimap(multimap);
}
}
}
}