class GroovyMultimap
{
Map map = [:]
public boolean put(Object key, Integer value)
{
List list = map.get(key, [])
list.add(value)
map."$key" = list
}
public String toString()
{
return map.toMapString()
}
public List get(Object key)
{
return map.get(key,null)
}
public Integer get_min(Object key)
{
def r=map.get(key,null)
if (r!=null)
{
return r.min();
}
else
{
return null;
}
}
}
def a=new GroovyMultimap()
a.put("1",1)
a.put("1",2)
println a.get_min("2")
[].min()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)