org.eclipse.collections.impl.multimap.set.UnifiedSetMultimap Maven / Gradle / Ivy
/*
* Copyright (c) 2015 Goldman Sachs.
* 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.multimap.set;
import java.io.Externalizable;
import org.eclipse.collections.api.block.predicate.Predicate2;
import org.eclipse.collections.api.map.MutableMap;
import org.eclipse.collections.api.multimap.Multimap;
import org.eclipse.collections.api.multimap.set.MutableSetMultimap;
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.impl.map.mutable.UnifiedMap;
import org.eclipse.collections.impl.set.mutable.UnifiedSet;
import org.eclipse.collections.impl.utility.Iterate;
public final class UnifiedSetMultimap
extends AbstractMutableSetMultimap implements Externalizable
{
private static final long serialVersionUID = 1L;
public UnifiedSetMultimap()
{
}
public UnifiedSetMultimap(Multimap extends K, ? extends V> multimap)
{
super(Math.max(multimap.sizeDistinct() * 2, 16));
this.putAll(multimap);
}
public UnifiedSetMultimap(Pair... pairs)
{
super(pairs);
}
public UnifiedSetMultimap(Iterable> inputIterable)
{
super(inputIterable);
}
public static UnifiedSetMultimap newMultimap(Multimap extends K, ? extends V> multimap)
{
return new UnifiedSetMultimap(multimap);
}
public static UnifiedSetMultimap newMultimap()
{
return new UnifiedSetMultimap();
}
public static UnifiedSetMultimap newMultimap(Pair... pairs)
{
return new UnifiedSetMultimap(pairs);
}
public static UnifiedSetMultimap newMultimap(Iterable> inputIterable)
{
return new UnifiedSetMultimap(inputIterable);
}
@Override
protected MutableMap> createMap()
{
return UnifiedMap.newMap();
}
@Override
protected MutableMap> createMapWithKeyCount(int keyCount)
{
return UnifiedMap.newMap(keyCount);
}
@Override
protected MutableSet createCollection()
{
return new UnifiedSet();
}
public UnifiedSetMultimap newEmpty()
{
return new UnifiedSetMultimap();
}
public MutableSetMultimap flip()
{
return Iterate.flip(this);
}
public UnifiedSetMultimap selectKeysValues(Predicate2 super K, ? super V> predicate)
{
return this.selectKeysValues(predicate, this.newEmpty());
}
public UnifiedSetMultimap rejectKeysValues(Predicate2 super K, ? super V> predicate)
{
return this.rejectKeysValues(predicate, this.newEmpty());
}
public UnifiedSetMultimap selectKeysMultiValues(Predicate2 super K, ? super Iterable> predicate)
{
return this.selectKeysMultiValues(predicate, this.newEmpty());
}
public UnifiedSetMultimap rejectKeysMultiValues(Predicate2 super K, ? super Iterable> predicate)
{
return this.rejectKeysMultiValues(predicate, this.newEmpty());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy