![JAR search and dependency download from the Maven repository](/logo.png)
edu.berkeley.nlp.util.ConcatenationMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of berkeleyparser Show documentation
Show all versions of berkeleyparser Show documentation
The Berkeley parser analyzes the grammatical structure of natural language using probabilistic context-free grammars (PCFGs).
The newest version!
package edu.berkeley.nlp.util;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Union of two maps (sort of). Doesn't handle duplicate keys (keys in both
* maps). Unmodifiable.
*
* @author adampauls
*
* @param
*/
public class ConcatenationMap extends AbstractMap
{
private Set> entrySet;
@Override
public Set> entrySet()
{
if (entrySet == null)
{
List>> list = new ArrayList>>();
for (Map map : maps)
{
list.add(map.entrySet());
}
entrySet = new ConcatenationSet>(list);
}
return entrySet;
}
@Override
public V get(Object arg0)
{
for (Map map : maps)
{
V v = map.get(arg0);
if (v != null) return v;
}
return null;
}
@Override
public boolean containsKey(Object arg0)
{
for (Map map : maps)
{
if (map.containsKey(arg0)) return true;
}
return false;
}
private Collection
© 2015 - 2025 Weber Informatics LLC | Privacy Policy