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